[Xapian-devel] Sorting results by a "sort expression"
Olly Betts
olly at survex.com
Fri Oct 10 02:42:54 BST 2008
On Thu, Oct 09, 2008 at 10:16:04AM -0500, Elliot Winkler wrote:
> I don't know if you're familiar with Sphinx but Sphinx allows you
> to pass a sort expression when you execute the search that will be evaluated
> against each result in the result set to calculate the final weight of the
> result [1]. You can refer to the already calculated weight in the expression
> (which in this case would be the default BM25 weight) as well as any of the
> values matched along with that document.
You might also want to look at Xapian::Sorter, which allows building a
sort key from document values. You can't use the calculated weight to
build the sort key though - if you want to involve the weight, you can
either sort by it before or after the generated sort key.
This restriction could be lifted, but currently we avoid calculating the
weight when we don't need it so we would need to see if this actually
makes a measurable difference here, and if so allow the Sorter to say it
wants the weight. Arjen's patch here adds passing the weight in a
simple way:
http://thread.gmane.org/gmane.comp.search.xapian.general/6446/focus=6501
Xapian::Sorter was added in 1.0.5.
Cheers,
Olly
More information about the Xapian-devel
mailing list