redneb at gmx.com
2010-Aug-27 07:00 UTC
[Xapian-discuss] Using relevance when sorting by generated key
Hi all, I am trying to implement a scheme where documents in an MSet will be sorted based on relevance as well as geographical distance from a given (non-fixed) point. I understand that this can be accomplished by using PostingSource in order to implement a custom weighting scheme that would combine BM25 weighting and distance. The problem is that I am using perl and PostingSource is not available for perl. Besides, I find this solution unnecessarily complicated. 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?
Olly Betts
2010-Sep-01 07:47 UTC
[Xapian-discuss] Using relevance when sorting by generated key
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
Possibly Parallel Threads
- Sorting results by a "sort expression"
- How to get the serialise score returned in Xapian::KeyMaker->operator().
- Sticky results
- Xapian Ruby bindings do not implement full multi-value-sorting functionality?
- How to get the serialise score returned in Xapian::KeyMaker->operator().