[Xapian-discuss] MSet order

Olly Betts olly at survex.com
Tue Mar 8 13:47:22 GMT 2011


On Tue, Mar 08, 2011 at 01:13:51PM +0000, Richard Boulton wrote:
> There's no way to do this with the current Xapian matcher.  However,
> what you can do is transform your weights so that they occur in
> reverse order (note that they must still remain positive, though).
> 
> So, one option would be to change your get_sumpart() function to
> return "max - w", where w is the value you're currently returning, and
> max is the value returned by get_maxpart().
> 
> If get_maxpart() isn't returning a tight bound, eg, you've had to
> return DBL_MAX for it, you might want to do a non-linear transform on
> your data to squash it into a more reasonable range - though that
> doesn't sound like it'll be a particular issue for you.

I'd suggest transforming the weights via 1 / (1 + w)

Then the best weight of 0 becomes 1, and larger (less good weights)
head towards zero.  And get_maxpart() would just return 1.

Cheers,
    Olly



More information about the Xapian-discuss mailing list