Solr Result Grouping / Field Collapsing

Result Grouping, also called Field Collapsing, has been committed to Solr!
This functionality limits the number of documents for each “group”, usually defined by the unique values in a field (just like field faceting).

You can think of it like faceted search, except instead of just getting a count, you get the top documents for that constraint or category. There are tons of potential use cases:

  • For web search, only show 1 or 2 results for a given website by collapsing on a site field.
  • For email search, only show 1 or 2 results for a given email thread
  • For e-commerce, show the top 3 products for each store category (i.e. “electronics”, “housewares”)
  • Hiding duplicate documents at query time.

In addition to being able to group by the values of a field, you can also group by the values of a function query. Given that geo search works as a function query, this also opens up possibilities for showing top query matches within 1 mile, between 1 and 2 miles, etc.

Just like faceting, we’ll be adding new functionality and making continual improvements.
Result Grouping is documented on the Solr Wiki, and you will need a recent
nightly build of Solr 4.0-dev to try it out (just make sure it’s dated after this post).

Share the knowledge

You Might Also Like

AI’s Shaggy Dog Problem

The digital marketplace is on the brink of a seismic shift, one...

Read More

How Enterprises Can Use MCP to Make AI Agents Smarter and More Reliable

Generative AI has made incredible strides — producing text, recommendations, and summaries...

Read More

What Is the Model Context Protocol (MCP) — and Why It Matters for Enterprise AI

Over the past year, enterprises have been captivated by the rise of...

Read More

Quick Links