Try our conversational search powered by Generative AI!

Filter by all categories



I've to filter a page type ie Article pages conating a list of categories

My query is

var selectedCategories = new List{1,2,3}

var result = _client.Search()


this code return articles conatain any of the categories in the list. But I want to return articles contain all the categories in list

Jan 16, 2018 6:42

You could try creating a extension method something like this. (haven't tested this)

 public static ITypeSearch<T> AllCategoriesMatch<T>(this ITypeSearch<T> search, IEnumerable<int> categories) where T : ICategorizable
      foreach (var category in categories)
          search = search.Filter(p => p.Category.Match(category));
            return search;

and in your query


Edited, Jan 16, 2018 13:14
* 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.