London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Hide type from public

Vote:
 

I'm having a bit of trouble with the PublicSearchFilter where basically want to hide all pages of a certain type (perhaps there is another way to do this but I'm unsure). To be clear, I only want to hide these from the public search but still want them to appear in the CMS.

I've managed to implement this, but it just incredibly dirty:

SearchClient.Instance.Conventions.UnifiedSearchRegistry
                .ForInstanceOf()
                .PublicSearchFilter(x => x.BuildFilter().And(y => ReturnFalse().Match(true)));

Where ReturnFalse() obviously returns false. I had to this this because having false.Match(true) is not valid because it's a constant. There must be a cleaner way or existing way to achieve this?

#133144
Aug 26, 2015 13:58
Vote:
 

How about something like

 .PublicSearchFilter(x => x.BuildFilter<InformationAndSupportLocationPage>().And(p => !p.MatchType(typeof(InformationAndSupportLocationPage))));
#133163
Aug 26, 2015 20:59
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.