Reputation: 571
In my Sitecore content tree there are few thousands of items, and I just want to alter few items programmatically. Instead of rebuilding the entire lucene index which is taking a big time, I want to update index entries for each item I'm altering in real time. I tried
item.Database.Indexes.UpdateItem(item);
but it is obsolete and ask me to use SearchManager
.
Can anyone guide me how to update index entries for a given item?
PS: I'm altering items from desktop application, not the website.
Upvotes: 3
Views: 2983
Reputation: 809
Well actually there is no Update operation on indexes, so feel free to do delete/add
Upvotes: -1
Reputation: 27132
Try to execute one of the HistoryEngine.RegisterItem...
methods, e.g:
item.Database.Engines.HistoryEngine.RegisterItemSaved(item, new ItemChanges(item));
item.Database.Engines.HistoryEngine.RegisterItemCreated(item);
item.Database.Engines.HistoryEngine.RegisterItemMoved(item, oldParentId);
Upvotes: 5