chicharito
chicharito

Reputation: 1087

Get one results of each value of column

I want to perform a search such that for top values of a column , i can get 'n' number of results.

for example consider country as one options having possible values as 1. USA (200 enteries) 2. UK (180 enteries) 3. CANADA (160 enteries) 4. ARGENTINA (140 enteries) 5. BRAZIL (120 enteries)

i want for top 3 countries i.e USA,UK,CANANDA i can get one row for every country using only single query?

Upvotes: 1

Views: 520

Answers (1)

Jayendra
Jayendra

Reputation: 52779

Check Solr Field Collapsing (Grouping).

use group=true&group.field=country to enable grouping on country field

This will help you group on a single valued field e.g. Country and limit the number of groups (rows) as well number of results per group (group.limit) allowing the ability to expand.

Complete list for parameters

Upvotes: 4

Related Questions