I'm using the following code to retrieve pages based on a list of categories:
var categoryFilter = SearchClient.Instance.BuildFilter<ExpertisePage>(); foreach (var categoryId in list) { categoryFilter.Or(x => x.InCategory(categoryId)); } return SearchClient.Instance.Search<ExpertisePage>() .Filter(categoryFilter) .OrderBy(e => e.PageName) .FilterForVisitor() .GetContentResult().ToList();
For some reason Find returns all pages of type ExpertisePage (for the current language). Seems like the filter is not applied at all.
I've tried using x => x.Match(categoryId) but result is the same.
Have you tried doing categoryFilter = categoryFilter.Or(...) instead?
Ah, you're right. My brain is still in weekend mode. :) Thanks, Alf!
I'm using the following code to retrieve pages based on a list of categories:
For some reason Find returns all pages of type ExpertisePage (for the current language). Seems like the filter is not applied at all.
I've tried using x => x.Match(categoryId) but result is the same.