It sounds like you need a database for analytics, not a search engine.
Solr cannot do aggregates like that. It can select and group, but to calculate averages you'll
need to fetch all the results over the network and calculate them yourself.
wunder
On Jul 7, 2012, at 9:05 AM, Jeremy Branham wrote:
> I’m sorry – I sent this email before I was confirmed in the group, so I don’t know
if anyone sent a reply =\
>
> __________________________________________
>
> 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
|