I came across business requirement where I want to delete item from master & web and also delete respective item from solr indexes. business don't want to publish parent item as there might be change i sibling or parent so I cant trigger any strategy like a onPublishEndAsync , onPublishEndAsyncSingleInstance onPublishEndAsyncPreview here I am trying something like below but it is not working
var ParentItem = item.Parent;
using (new EditContext(item))
{
if (Sitecore.Configuration.Settings.RecycleBinActive)
item.Recycle();
else
item.Delete();
}
if (item == null)
return;
ISearchIndex index = ContentSearchManager.GetIndex((SitecoreIndexableItem)ParentItem );
if (index == null)
return;
index.Refresh(new SitecoreIndexableItem(ParentItem )); or
index.RefreshAsync(new SitecoreIndexableItem(item), IndexingOptions.ForcedIndexing, new System.Threading.CancellationToken());
I am not getting any error in sitecore log or solr log files but index is not deleting item