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.
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.
Bump...
It works if I move the filters to my query. But I want to have these filters for every public search.
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)));
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:
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().
Please help