This chapter covers
- Excluding duplicate documents from search results
- Returning multiple groups of query results in a single search request
- Ensuring variety in search results by showing multiple document categories
- Grouping query results by field values, queries, or functions
- Data-partitioning strategies necessary for scaling Solr’s grouping functionality
Result grouping is a useful capability in Solr for ensuring that an optimal mix of search results is returned for a user’s query. Result grouping, commonly referred to as field collapsing, is the ability to ensure only one document (or some limited number) is returned for each unique value (actual or dynamically computed) within a field. This can be useful if you have multiple similar documents—products from the same company, locations for the same restaurant chain, or companies with multiple offices—but do not want an entire page of search results to only represent a single product, restaurant, or company.