Search code examples
solrlucenefull-text-searchsearch-enginefieldcollapsing

Grouping results and keeping facet counts consistent


Using Solr 3.3
Key Store Item Name Description Category Price
=========================================================================
1 Store Name Xbox 360 Nice game machine Electronic Games 199.99
2 Store Name Xbox 360 Nice game machine Electronic Games 199.99
3 Store Name Xbox 360 Nice game machine Electronic Games 249.99

I have data similar to above table and loaded into Solr. Item Name, description Category, Price are searchable.

Expected result

Facet Field         
 Category             
   Electronic(1)   
   Games(1) 

 **Store Name** 
 XBox 360 Nice game machine priced from 199.99 - 249.99

What will be the query parameters that I can send to Solr to receive results above, basically I wan to group it by Store, ItemName, Description and min max price

And I want to keep paging consistent with the main (StoreName). The paging should be based on the Store Name group. So if 20 stores were found. I should be able to correctly page.

Please suggest


Solution

  • What I did is I created another field that grouped the required fields in a single field and stored it, problem solved, so now I just group only on that field and I get the correct count.