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: http://i.imgur.com/nC1Opmv.png.
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?
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());
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.
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.
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.
I guess I have to fire up an EPi7 website and compare the filters.
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.
Yeah. Integration tests tend to come in handy :)