lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: Sum? Filter in term search? Something else?
Date Fri, 08 Jan 2010 14:47:38 GMT
I think the StatsComponent will do everything you're asking for here:

On Jan 8, 2010, at 9:37 AM, dbashford wrote:

> I get the feeling what I need to accomplish isn't necessarily in the  
> spirit
> of what solr is meant to do, but it's the problem I'm facing.  Of  
> course,
> I'm a solr newbie, so this may not be as challenging as I think it is.
> Domain is a little tricky, so I'll make one up.  Lets say I have the
> following 3 pieces of information in my index ==> Book Id, Book
> Category(mystery, fantasy, etc), # of Pages.  And lets say there's a
> million, two million...a lot of books.
> Question 1) Is there a way to get a total number of pages across all  
> books
> without pulling every book and iterating over the result?  (Lets  
> pretend
> doing so is a worthwhile endeavor.)
> One thing I've found I can do to reduce iteration is to do a term  
> search on
> # of pages, which does a little gathering up for me.  If books have  
> between
> 100 and 1000 pages, I've got 900 results to iterate over, little  
> multiplying
> and adding and I have what I need.  That's acceptable, and in this  
> case its
> definitely faster than going to the database and querying a poorly
> normalized group of tables, but still, if there was some way to just  
> get a
> sum...
> Question 2) The next question would be, assuming there's some way to  
> get a
> sum for all books, how would I get a sum for all books that are  
> mysteries?
> I don't think the term search works here because I can't seem to  
> find a way
> to limit the docs the term search uses.
> Thanks in advance for any help you can provide!
> -- 
> View this message in context:
> Sent from the Solr - User mailing list archive at

View raw message