Skip to content

Instantly share code, notes, and snippets.

@Mitya88
Created February 11, 2019 10:09
Show Gist options
  • Save Mitya88/542b102f7c84d3a87eb02417cb4b3718 to your computer and use it in GitHub Desktop.
Save Mitya88/542b102f7c84d3a87eb02417cb4b3718 to your computer and use it in GitHub Desktop.
public class ExcludeClonedItemsCrawler : SitecoreItemCrawler
{
protected override bool IsExcludedFromIndex(SitecoreIndexableItem indexable, bool checkLocation = false)
{
var obj = (Item)indexable;
if (obj.IsClone)
{
this.Index.Locator.GetInstance<IEvent>().RaiseEvent("indexing:excludedfromindex", (object)this.index.Name, (object)obj.Uri);
return true;
}
return base.IsExcludedFromIndex(indexable, checkLocation);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment