Try our conversational search powered by Generative AI!

Excluding pages from index


Got an issue with trying to disable pages from the Index.

In globla I'm setting up the following:

ontentIndexer.Instance.Conventions.ForInstancesOf<BasePageData>().ShouldIndex(x => !x.HideFromSearch);


Setting the HideFromSearch property on a page and running the reindexing job works fine. I.e the page is excluded from the index. But if I go in and set the property and just publish the page it isn't removed from the index. Instead the "old" document of the page is still in the index. 

Is there a way to force Find to delete pages on the publish event?

Nov 04, 2013 13:59

This is not exactly the answer to your question, but it will solve your problem:

You can make a filter instead like this:

public ITypeSearch<IBasePageData> HideFromSearchFilter(ITypeSearch<IBasePageData> searchQuery)
searchQuery = searchQuery.Filter(x => x.ExcludePageFromSearch.Match(false));
return searchQuery;


You need to customize the code a some for your solution, but you get the point.

Nov 05, 2013 13:58

Thanks Andreas!


That would work but as we depend on the Index on more then one place it feels it could become cumbersum. So I would rather see it remove from the Index.

I have been talking to EPi some on the side and it seems what I need to do is to make my own hook on the change event and check if the page should be deleted.

But I might have been able to convince EPi that this should work out of the box so let's keep our fingers crossed! =)

Nov 05, 2013 14:20


At the moment @Petter Klang you need to do like you said and listen to the event and then check if that thing has changed and then do a delete of the item.

I have also put this on the backlog so that it will be implemented soon.


Thanks for pointing us in this direction.

Nov 05, 2013 14:31


ShouldIndex is called right before indexing so I would just do:

ContentIndexer.Instance.Conventions.ForInstancesOf<StandardpagePageType>().ShouldIndex(x =>
var shouldIndex = x.HideFromSearch;
if (!shouldIndex)

return shouldIndex;

to remove the content.


Nov 18, 2013 16:21

Thanks Henrik Lindström, this was exactly what I was after.
One question. Why do you ignore the catch, what can happen there that are of no importence?

Nov 20, 2013 9:07
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.