You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jeremy Branham <jd...@hotmail.com> on 2012/07/07 02:18:54 UTC

Grouping and Stats

Hello -
I’m not sure If this is an appropriate use for Solr, but I want to stay away from a typical DB store for high availability reasons.

I am storing documents that may have a common value for a field we’ll call “category”.
In another field there will be an integer field we’ll call “rating”.

I would like to group the documents on the “category” field and display the average “rating” per group.

The stats component lets me get the avg rating, but when I collapse the results into groups it gives me the average for the entire collection, rather than for the specific group.

Am I going about this wrong?
Is it possible to get the desired outcome with a  single query?

I’d appreciate any insight!
Thank you,

Jeremy Branham
Software Engineer
http://LinkedIn.com/in/JeremyBranham 
http://jeremybranham.wordpress.com/ 
http://Zeroth.biz