简体   繁体   中英

How to update a single item in a Sitecore index?

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.

Try to execute one of the HistoryEngine.RegisterItem... methods, eg:

item.Database.Engines.HistoryEngine.RegisterItemSaved(item, new ItemChanges(item));
item.Database.Engines.HistoryEngine.RegisterItemCreated(item);
item.Database.Engines.HistoryEngine.RegisterItemMoved(item, oldParentId);

实际上索引上没有Update操作,所以随意做删除/添加

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM