We are indexing documents into Solr using Solrnet in asp.net c# project. We are having requirement where Solr DIH can not be used, so we are indexing products in certain batches to Solr using following code:
decimal cycleCount = ProductCount / batchSize;
for (int i = 0; i <= Math.Round(cycleCount); i++)
{
var Products = Products(batchSize, languageId, storeId).ToList();
solrCustomWorker.Add(solrProducts);
solrCustomWorker.Commit();
}
With huge document size, it takes lot of time (most of times it takes few hours) to complete whole process, and sometimes we are having requirement to stop this process in-between by manual intervention.
However, I am not sure how to stop this indexing batch cycles in between before it completes. A single cycle with large batch size of documents, takes few seconds to complete and then it commit. But considering huge no. of documents, while performing full indexing it takes few hours and we're unable to stop this process in between.
Any idea - how can I stop this process in-between.. I'm unable to figure out what should be done here?
Please suggest.