Grouping documents by the query value

Sometimes, grouping results on the basis of field values is not enough. For example, imagine that we would like to group documents in some kind of price brackets—show the most relevant document for documents with the price range of 1.0 to 19.99, a document for documents with the price range of 20.00 to 50.0, and so on. Solr allows you to group results on the basis of queries results. This recipe will show you how to do that.

Getting ready

In this chapter, we will use the same index structure and test data as we used in the Grouping documents by the field value recipe in this chapter. Read it before we continue.

How to do it…

  1. Because we are reusing the data and index structure from the Grouping documents by the ...

Get Solr Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.