Take a look at the "stats" component that calculates aggregate values. It
has a "facet" parameter that may or may not give you something similar to
what you want. Or, just form a query that matches the results of the group,
and then get the stats.
See:
http://wiki.apache.org/solr/StatsComponent
-- Jack Krupansky
-----Original Message-----
From: Jamshaid Ashraf
Sent: Thursday, July 11, 2013 7:56 AM
To: solr-user@lucene.apache.org
Subject: Applying Sum on Field
Hi,
I'm a new solr user, I wanted to know is there any way to apply sum on a
field in a result document of group query?
Following is the query and its result set, I wanted to apply sum on 'price'
filed grouping on type:
*Sample input:*
<doc>
<str name="id">3</str>
<str name="type">Caffe</str>
<str name="content">Yummm Drinking a latte at Caffe Grecco in SF shistoric
North Beach Learning text analysis with SolrInAction by Manning on my
iPad</str>
<long name="_version_">1440257540658036736</long>
<int name="price">250</int>
</doc>
<doc>
<str name="id">1</str>
<str name="type">Caffe</str>
<str name="content">Yummm Drinking a latte at Caffe Grecco in SF shistoric
North Beach Learning text analysis with SolrInAction by Manning on my
iPad</str>
<long name="_version_">1440257592044552192</long>
<int name="price">100</int>
</doc>
*
*
*Query:*
http://localhost:8080/solr/collection2/select?q=caffe&df=content&group=true&group.field=type
your help will be greatly appreciated!
Regards,
Jamshaid