November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi Ash,
Out-of-the-box is not available but you can delete it programmatically.
ContentIndexer.Instance.TryDelete(page, out var result);
And for future index rebuild, you can introduce a field on the page like "DisableForIndex" and exclude it from the index when rebuilding the index
private bool ShouldIndexPageData(SolutionPageData page)
{
var wastedContent = ServiceLocator.Current.GetInstance<IContentLoader>().GetDescendents(ContentReference.WasteBasket).ToList();
//Check if the page is published, not marked as disable indexing, etc
var shouldIndex = page.CheckPublishedStatus(PagePublishedStatus.Published)
&& wastedContent.All(c => c.ID != page.PageLink.ID) //content in wastebasket should not be indexed
&& !page.DisableIndexing;
//The page should not be indexed, but in some scenarios it might already be indexed, so try to delete it.
if (!shouldIndex)
{
ContentIndexer.Instance.TryDelete(page, out var result);
}
return shouldIndex;
}
More info available here
Hello Ravindra,
Thanks for the reply, but i want to delete index for expired pages so where i have to place this "ContentIndexer.Instance.TryDelete(page, out var result);" in code.
I think you can create a schedule job for it.
https://ravindrasrathore.wordpress.com/2019/09/29/reindex-a-target-site-in-find-schedule-job/
If you want to do this manually, I think the easiest is to install the nuget package EpiCode.InspectInIndex as described here: https://www.gulla.net/inspect-your-episerver-find-index/
how to delete index for a specific page?