Try our conversational search powered by Generative AI!

Remove types from UnifiedSearch



I'm pulling my hair... I don't know what's wrong here, this has always worked before. I'm removing a type in an InitializableModule:


But the type is still showing up in search. What am I missing? I've clear the index, reindexed and so on.

I'm on the latest version,

On a related note, I'm also trying to apply PublicSearchFilter, but can't get that to work either. filterForPublicSearch is set to true in GetResult().

    .PublicSearchFilter(client => client.BuildFilter()
        .And(f => f.PublicSearchFilter.Match(true)));

Please help

Nov 19, 2014 4:44

I have verified with Fiddler that the types are not added to the filter in the outgoing query to Find API.

The public search filter is however added to the query. But hits that doesn't match the filter are returned anyways.

Edited, Nov 20, 2014 1:04

Ok, I got why my types were not excluded. They need to be added explicitly first, which means I have to remove PageData first and then add every type I want to search for instead.

So I guess I could use a filter instead. Problem is, I can't get the public search filter to work :(

This what I have:

    .PublicSearchFilter(client => client.BuildFilter<PageData>()
        .And(page => !page.MatchTypeHierarchy(typeof(IExcludeFromUnifiedSearch)))
        .And(page => !((MetaDataPageDataBase)page).ExcludePageFromSearch.Match(true)));

I want to exclude types that I have marked with an interface and pages that are of type MetaDataPageDataBase and have ExcludePageFromSearch set to true.

Edited, Nov 20, 2014 2:24


It works if I move the filters to my query. But I want to have these filters for every public search.

Nov 27, 2014 7:39

I don't know if there was a bug. But when I upgraded to latest version of Find, following code started to work again:

    .PublicSearchFilter(client => client.BuildFilter<PageData>()
        .And(page => !page.MatchTypeHierarchy(typeof(IExcludeFromUnifiedSearch)))
        .And(page => !page.MatchTypeHierarchy(typeof(IContainerPage)))
        .And(page => ((MetaDataPageDataBase)page).ExcludePageFromSearch.Match(false)));
Feb 03, 2015 19:20
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.