Multiple match DelegateFilterBuilder



I need to find content where multiple categories are set.

In this code I want to find all SitePageData where Category is 2 AND 3. I thought the DelegateFilterBuilder "In" would help me with this but it seem to handle it as 2 OR 3.

Is there some smart way to do this?

var categoryIds = new List<int> { 2, 3 };
var result = SearchClient.Instance.Search<SitePageData>()
.Filter(c => c.Category.In(categoryIds))


Jun 09, 2014 14:53
var query = SearchCilent.Instance.Search<SitePageData>();
var catalogBuilder = searchInstance.BuildFilter<SitePageData>();
foreach (int category in categoryIds)
	catalogBuilder = catalogBuilder.And(x => x.Category.Match(category));

result = query.Filter(catalogBuilder).GetContentResult;

Think something like that should do the trick.

Jun 09, 2014 14:57

It sure did!


Jun 10, 2014 9:15
Jun 10, 2014 9:52
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.