Does Sitecore Content Search support group by clause?
If yes then what are the namespace / references are needed?
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.
Sign up to join this communityDoes Sitecore Content Search support group by clause?
If yes then what are the namespace / references are needed?
LINQ to Sitecore
, which is used by Sitecore Content Search
does not support GroupBy
.
Here is the full list of not supported IQueryable
methods:
You can read more in Sitecore documentation here: https://doc.sitecore.com/developers/90/sitecore-experience-manager/en/linq-to-sitecore.html
Above answer is spot on, content search does not support Group By directly.
Adding some extra information about group by support in content search with Solr. From Sitecore 9 on wards, there are extra functionalities (Group, Highlights, Spell checker, etc) which are on top of the existing content search API.
As Content Search API abstracts search providers, we can change providers without any code updates. But Group By is specific to Solr, once we use this, cannot be easily switched between the providers.
Below information is from Sitecore Documentation: https://doc.sitecore.com/developers/93/platform-administration-and-architecture/en/using-solr-to-group-search-results.html
Sitecore has an API that you use to access the result grouping feature of Solr. The API is designed as an extension to the existing ContentSearch API.
Follow these steps to use the API in your project:
Reference the following DLL files into your project (you can get them from the bin folder of your Sitecore website):
Import the following namespace:
You can now use the Result Grouping API as part of ISearchIndex: