I've got a Sitecore application, which creates and uses a number of Lucene indexes through Sitecore's built-in API.
I need to make sure that items in the index are kept up-to-date when they are published. To do this, I've created a Sitecore Hook that detects when and item is saved to the "web" database and reindexes the item. It seems to be working for the most part, but it seems to inexplicibly fail from time to time.
The code I have in the hook looks like:
item.Database.Indexes.RemoveItem(item, true);
item.Database.Indexes.UpdateItem(item);
Anyone ever try this before and have a better solution?