I’m using Sitecore 7 and the Solr Search provider. I currently have the site setup to update the search index when publishing an item.
I’ve noticed that when the CMS author creates different versions of an item and then submits these into the index the previous version of the item is not removed from the index, so the index contains multiple versions of the same Sitecore item.
Does anyone know of any settings, that I can change, to make sure that the previous version is removed from the index before adding the new version?
I’ve tried running some code like below to remove the items from the index just before publishing, but the Delete method on the index doesn’t seem to delete anything.
var indexableItem = (SitecoreIndexableItem)item;
ContentSearchManager.GetIndex(index).Delete(indexableItem.UniqueId
Any help much appreciated.
I contacted Sitecore on this one and they have said that this is likely to be a bug and they are investigating.
As a workaround, Sitecore recommend using the Inbound and Outbound filters to filter items in the index.
Here's some more information on that:
UPDATE: @Jason in the comments below pointed out that is now a support fix for this - see knowledge base article - https://kb.sitecore.net/articles/992608