[Xapian-discuss] Using relevance when sorting by generated key

Olly Betts olly at survex.com
Wed Sep 1 08:47:56 BST 2010


On Fri, Aug 27, 2010 at 03:00:30AM -0400, redneb at gmx.com wrote:
> A more simple solution would be if the sorter in  
> Xapian::Enquire::set_sort_by_key provided an extra argument for  
> Xapian::Sorter::operator, namely the weight of the current document with  
> respect to the current query. Does this make sense? Is it possible to  
> implement something like that in some future version of xapian?

The big problem with this approach is that we'd have to turn off all the
weight-based optimisations in the matcher when a sorter which used the
weight was in use, because we have no idea what it might do with it.  So you'd
take a speed hit in this case - it was a deliberate choice not to pass the
weight to Sorter::operator() for this reason.

The PostingSource API allows an upper bound on the returned weights to be
obtained by the matcher, and it can use this bound in the same way it uses the
weight bounds it has for terms.

Another issue is that the amended operator() method would make this an ABI
incompatible change which means we couldn't do it in the near future anyway -
wrapping PostingSource for Perl could be done much sooner.

Cheers,
    Olly



More information about the Xapian-discuss mailing list