1
votes

I have product index at solr, product has category field and I need to select one product (better would be random) from each category, how query would look like?

1
if you would move that to answer, I would mark it as the right one ;)Giedrius

1 Answers

4
votes

if you are looking for sql group by feature,
with solr 3.3 on-wards, it has the similar feature called FieldCollapsing

Field Collapsing collapses a group of results with the same field value down to a single (or fixed number) of entries. For example, most search engines such as Google collapse on site so only one or two entries are shown, along with a link to click to see more results from that site. Field collapsing can also be used to suppress duplicate documents.