Remove types from UnifiedSearch

Vote:
 

Hi,

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:

SearchClient.Instance.Conventions.UnifiedSearchRegistry.Remove(typeof(CalendarYearPage));

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, 8.8.0.1354.

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().

SearchClient.Instance.Conventions.UnifiedSearchRegistry.ForInstanceOf()
    .PublicSearchFilter(client => client.BuildFilter()
        .And(f => f.PublicSearchFilter.Match(true)));

Please help

#113355
Nov 19, 2014 4:44
Vote:
 

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.

#113417
Edited, Nov 20, 2014 1:04
Vote:
 

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:

SearchClient.Instance.Conventions.UnifiedSearchRegistry.ForInstanceOf<PageData>()
    .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.

#113420
Edited, Nov 20, 2014 2:24
Vote:
 

Bump...

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

#113727
Nov 27, 2014 7:39
Vote:
 

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

SearchClient.Instance.Conventions.UnifiedSearchRegistry.ForInstanceOf<PageData>()
    .PublicSearchFilter(client => client.BuildFilter<PageData>()
        .And(page => !page.MatchTypeHierarchy(typeof(IExcludeFromUnifiedSearch)))
        .And(page => !page.MatchTypeHierarchy(typeof(IContainerPage)))
        .And(page => ((MetaDataPageDataBase)page).ExcludePageFromSearch.Match(false)));
#116673
Feb 03, 2015 19:21
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.