Search code examples
indexingsitecorelucene.netsitecore6

How to disable index updating for a single item in Sitecore programmatically


In my Sitecore web application, I'm creating a new item and do several updates to that item in various places in the code and finally conclude the saving process. This many times of alterations to the item causes to have new table records in the History table to be created for index updating as below,

Created
Saved
Saved
Saved
Saved
Saved
Saved
Saved

This many entries causes the indexing process to check many entries which are not required, but I actually want is to have only two records as,

Created
Saved

How can I disable the creation of the Saved entries temporarily for an item(like having kind of IndexUpdateDisabled() context)?


Solution

  • Ideally, you should call item.Editing.BeginEdit() only once, at the beginning of your flow. Once you reach the final step, you complete the edit with item.Editing.EndEdit();

    If this for some reason isn't doable in your setup, you could resort to making silent updates. At each step, call item.Editing.EndEdit(false, true) and only on the final step use the parameterless overload item.Editing.EndEdit()