--- On Wed, 8/11/10, Moazzam Khan <moazz...@gmail.com> wrote:

> From: Moazzam Khan <moazz...@gmail.com>
> Subject: Re: Need help with facets
> To: solr-user@lucene.apache.org
> Date: Wednesday, August 11, 2010, 1:32 AM
> Thanks Ahmet that worked!
> 
> Here's another issues I have :
> 
> Like I said before, I have these fields in Solr documents
> 
> FirstName
> LastName
> RecruitedDate
> VolumeDate (just added this in this email)
> VolumeDone (just added this in this email)
> 
> 
> Now I have to get sum of all VolumeDone (integer field) for
> this month
> by everyone, then take 25% of that number and get all
> people whose
> volume was more than that. Is there a way to do this? :D

You need to execute two queries for that. Stats Component can give you sum.  
q=VolumeDate:[NOW-1MONTH TO NOW]&stats=true&stats.field=VolumeDone

http://wiki.apache.org/solr/StatsComponent

Then second query
q=VolumeDate:[NOW-1MONTH TO NOW]&fq=VolumeDone:[sumComesAbove TO *]

But you need to use tint type instead of int for VolumeDone, to range queries 
work correctly.


      

Reply via email to