Result grouping

Result grouping is a useful feature in Solr; it returns an optimal mix of search results for a query. Result grouping can be performed based on field values, functions, or queries.

Sometimes, we have multiple similar documents for a single search term, for example, multiple locations for the same hospital, recipes for specific food, plans for term insurance, and so on. In the normal way, if we are searching for one such term, it will return all similar documents and we will have to display all of them on the same page. Through result grouping, we can display only a single document (or the top few or some limited number) for each unique value, and provide a message link with meaningful text and the number of total results found for that query. Clicking on that link will expand the full search result list. This is similar to the expand and collapse features of a search application. Result grouping is just as capable as expand and collapse; additionally it removes duplicate documents from the list. But from a performance point of view, expand and collapse is a better choice than result grouping.

We looked at faceting in the previous chapter. Result grouping also looks similar to faceting, but through faceting, Solr returns a separate facet section along with the counts for each value. Through result grouping, it actually returns the unique values and their counts (like faceting) plus a number of documents that contain each of the specified values. Also, groups returned in the results section are sorted based on the sorting parameter provided inside the query.

Combining grouping with faceting is also possible. Currently, field and range faceting are included in grouped faceting, but date and pivot faceting are not included. The facet counts are calculated based on the first group.field parameter and other group.field parameters are ignored.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.42.87