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!

Having trouble with a filter

Vote:
 

When searching I only want to get pages in specific branches of the page tree.

This works fine:

myQuery.Filter(x => x.Ancestors().Match("48"))

But shouldn't this give the same result?

var pageBranchFilter = SearchClient.Instance.BuildFilter();
pageBranchFilter.Or(x => x.Ancestors().Match("48"));
myQuery.Filter(pageBranchFilter);

The second approach is completely ignored when doing the search.

#188760
Mar 02, 2018 11:07
Vote:
 

Answering my own question:

var pageBranchFilter = SearchClient.Instance.BuildFilter<IContent>();
pageBranchFilter = pageBranchFilter.Or(x => x.Ancestors().Match("48"));
myQuery = myQuery.Filter(pageBranchFilter);

face-palm.... :-)

#188938
Mar 07, 2018 11:36
Vote:
 

Answering my own question:

var pageBranchFilter = SearchClient.Instance.BuildFilter<IContent>();
pageBranchFilter = pageBranchFilter.Or(x => x.Ancestors().Match("48"));
myQuery = myQuery.Filter(pageBranchFilter);

face-palm.... :-)

#188939
Mar 07, 2018 11:36
Vote:
 

Answering my own question:

var pageBranchFilter = SearchClient.Instance.BuildFilter<IContent>();
pageBranchFilter = pageBranchFilter.Or(x => x.Ancestors().Match("48"));
myQuery = myQuery.Filter(pageBranchFilter);

face-palm.... :-)

#188940
Mar 07, 2018 11:36
Vote:
 

Answering my own question:

var pageBranchFilter = SearchClient.Instance.BuildFilter<IContent>();
pageBranchFilter = pageBranchFilter.Or(x => x.Ancestors().Match("48"));
myQuery = myQuery.Filter(pageBranchFilter);

face-palm.... :-)

#188941
Mar 07, 2018 11:37
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.