UnifiedSearch FilterForVisitor in EPiServer 6?

Member since: 2007

Hi,

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?

#65316 Jan 25, 2013 22:24
  • Member since: 2007

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

        

    #65318 Jan 25, 2013 22:28
  • Hey,

    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.

    #65327 Jan 26, 2013 12:08
  • Member since: 2007

    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.

    #65328 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.

    #65329 Jan 26, 2013 12:56
  • Member since: 2007

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

    #65330 Jan 26, 2013 13:11
  • Member since: 2007

    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.

    #65353 Jan 28, 2013 9:58
  • Yeah. Integration tests tend to come in handy :)

    #65355 Jan 28, 2013 10:01