I'd start with the simple approach of a stored field and only worry about performance if you needed to. Field caching would likely help if you did need to.
-- Ian. On Mon, Oct 14, 2013 at 2:04 AM, Stephen GRAY <stephen.g...@immi.gov.au> wrote: > UNOFFICIAL > Hi everyone, > > I'd appreciate some help with a problem I'm having. I have a collection of > documents in my index. Each doc contains an IntField with a value in it. What > I want is to find out the minimum, maximum and sum of this field for all > documents returned by a search. > > I was thinking that I could do this by adding my documents to a facet, then > using AssociationIntSumFacetRequest to calculate the sum over the facet > returned, but I can't figure out how to use AssociationIntSumFacetRequest - > there is nowhere to pass on the name of the field I want to sum over for > example. As for getting the minimum and maximum, presumably you'd have to > write your own FacetRequest, which is hard. > > I could store the field, then iterate over all the docs returned, getting > each doc and calculating min, max and sum, but in my index there are likely > to be upwards of 10 million documents after a while so this might be rather > slow. > > Any help would be greatly appreciated. > > Thanks, > Steve > > UNOFFICIAL > > > -------------------------------------------------------------------- > Important Notice: If you have received this email by mistake, please advise > the sender and delete the message and attachments immediately. This email, > including attachments, may contain confidential, sensitive, legally privileged > and/or copyright information. Any review, retransmission, dissemination > or other use of this information by persons or entities other than the > intended recipient is prohibited. DIAC respects your privacy and has > obligations under the Privacy Act 1988. The official departmental privacy > policy can be viewed on the department's website at www.immi.gov.au. See: > http://www.immi.gov.au/functional/privacy.htm > > > --------------------------------------------------------------------- > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org