[Xapian-discuss] Summing collapsed values

Simon Roe simon.roe at talusdesign.co.uk
Wed Mar 25 20:26:17 GMT 2009


On Wed, Mar 25, 2009 at 7:45 PM, Richard Boulton
<richard at lemurconsulting.com> wrote:
> On Wed, Mar 25, 2009 at 07:08:56PM +0000, Simon Roe wrote:
>> On Wed, Mar 25, 2009 at 6:36 PM, Richard Boulton
>> <richard at lemurconsulting.com> wrote:
>> > And you want, for each of those documents to get the sum of the "amount"
>> > for all the items which were collapsed?  ie, "15" for year=2000, "20" for
>> > year=2001.
>>
>> Another element I've just thought of:  I'd like to sort by the summed
>> value too...
>>
>> I guess that eliminates the double search option, would the matchspy
>> option handle this?
>
> No - you won't be able to sort by the summed value inside xapian; this kind
> of thing isn't really how Xapian is designed to be used.  I wouldn't expect
> this search to return very many results, though (it's limited by the number
> of years in your database), so it seems like you might well be able to sort
> the results outside xapian.


Hmm, looks like I'll need to rethink then -- my example was simplified
and in reality the 'year' value is a recipient ID, with over 8 million
unique values...so sorting out of xapian isn't practical.

I might be able to calculate this at index time though.

Thanks for your help.

-- 
Help save the economy:
http://seriouschange.org.uk/

E: simon.roe at talusdesign.co.uk
M: 07742079314



More information about the Xapian-discuss mailing list