2

We are programmatically creating items and using Solr indexes so we want to disable solr indexing whenever we create an item.

We tried following code to disable during item creation Item.Add()

Sitecore.Configuration.Settings.Indexing.Enabled = false;

But it does not stop indexing and still happen in Solr. What can be the possible reason?

6

Code which you have used, it works only for "old" indexes, but not for the Sitecore 7 indexes. I am sure you must be using old one.

You should try to disable/enable indexing as follows

Sitecore.ContentSearch.Maintenance.IndexCustodian.PauseIndexing();
// Add code to create item
IndexCustodian.ResumeIndexing();

Also add check whether indexing is currently paused or not with the use of the following:

IndexCustodian.IsIndexingPaused(ISearchIndex index )
5

You can do in next way :

IndexCustodian.PauseIndexing();
  // Create items, etc 
  // Enable indexing again. 
IndexCustodian.ResumeIndexing();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.