Category filter not working


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>()
                    .OrderBy(e => e.PageName)


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.

May 12, 2014 13:42

Have you tried doing categoryFilter = categoryFilter.Or(...) instead?

May 12, 2014 14:08

Ah, you're right. My brain is still in weekend mode. :) Thanks, Alf! 


May 12, 2014 14:18
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.