Try our conversational search powered by Generative AI!

UnifiedSearch FilterForVisitor in EPiServer 6?



We're using UnifiedSearch in a EPiServer 6 R2 project with PageTypeBuilder. By default Find doesn't filter the hits by access rights and so on, in EPiServer 7 it does though.

I've reflected the EPiServer.Find.Cms assembly for EPi 7 and ported the filters and it seems to work. But I would like to have my outgoing JSON confirmed, so here it is:

And I also would like to know what the difference is between AlwaysApplyFilter and PublicSearchFilter? My guess is PublicSearchFilter appends filters to the request and AlwaysApplyFilter just when the objects are indexed?

Jan 25, 2013 22:24

Oh by the way, this is how I register the filters:

SearchClient.Instance.Conventions.UnifiedSearchRegistry.Add<MetaDataPageTypeBase>().PublicSearchFilter(c => c.BuildFilter<MetaDataPageTypeBase>().ExcludePageInSearch<MetaDataPageTypeBase>());

SearchClient.Instance.Conventions.UnifiedSearchRegistry.Add<PageData>().PublicSearchFilter(c => c.BuildFilter<PageData>().FilterForVisitor<PageData>());

SearchClient.Instance.Conventions.UnifiedSearchRegistry.Add<UnifiedFile>().PublicSearchFilter(c => c.BuildFilter<UnifiedFile>().FilterOnUnifiedFileReadAccess());


Jan 25, 2013 22:28


When you do GetResult using unified search you can specify a number of settings. One of those is wether to filter for public search/display. It's true by default if I don't recall wrong. If true, it applies filters registered using PublicSearchFilter, otherwise not.

Jan 26, 2013 12:08

Thanks Joel. And filterForPublicSearch is true by default.

But what about the the JSON, is anything missing and/or is plain wrong? It seems right to me.

Jan 26, 2013 12:22

Well, it's kind of hard to say from just looking at the JSON but I *think* it generally looks good.

There may be an edge case where a page is in the waste basket but IsDeleted isn't true. I can't recall if that's actually the case and if so when that happens, but I believe you'd have to do some fairly funky stuff for that to happen.

One thing I noticed was that there's a language branch filter that seems to be ORed with a filter for publication status and publish dates. I may be wrong, but I would guess that it should be ANDed instead.

Jan 26, 2013 12:56

I guess I have to fire up an EPi7 website and compare the filters.

Jan 26, 2013 13:11

I have compared the two now and according to me they should not be ANDed. If I do I get no results at all.

You really need a regex brain to read this sort of things.

Jan 28, 2013 9:58

Yeah. Integration tests tend to come in handy :)

Jan 28, 2013 10:01
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.