Using the json facet api is quite easy
Check out: http://yonik.com/json-facet-api/#TermsFacet
http://solr:8983/solr/your_collection/select?q=*:*=json=true=
{
property_codes_group_by : {
type : terms,
field : property_code,
facet : { sum_price : "sum(price)" }
}
}
2016-07-29 7:47 GMT-03:00 andreap21 :
> Hi,
> is there any way in SOLR 5.3 to achieve grouping and do mathematical
> operations like sum, avg on a certain document property?
>
> Please find below example:
>
>
> HIKS
> Hotel Holiday Inn King's cross
> 4
> 40.99
>
>
>
> HIKS
> Hotel Holiday Inn King's cross
> 4
> 40.99
>
>
>
> HIKS
> Hotel Holiday Inn King's cross
> 4
> 40.99
>
>
> We would need to group by the property_code (HIKS) and get the sum of all
> the prices from the resulting group.
>
>
> Thanks,
> Andrea
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Group-and-sum-in-SOLR-5-3-tp4289556.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>