Reputation: 621
I have a list of cars.
I d like to know whats the most frequent color of car in my list customers buy.
How can I do that?
So far my query is
"params": "q=group:true%26group.field:colour"
but Solr is telling me
"error": {
"msg": "undefined field group",
"code": 400
}
Upvotes: 0
Views: 240
Reputation: 9320
You could get most frequest color pretty easy, using facet functionality. You need to add to your existing query:
facet.field=colour&facet=on&facet.sort=count
where colour should be the name of the field you want to get facets. facet.sort param defines how you want to sort your facets. Since you want to get most frequent value, you need to sort by count.
For more information take a look here - https://lucene.apache.org/solr/guide/6_6/faceting.html
Upvotes: 1