[Xapian-discuss] sorting question

Olly Betts
Wed, 22 Jul 2009 04:59:45 -0000

On Mon, Jul 20, 2009 at 04:49:48PM -0400, Jim Spath
wrote:
> Is there any way to sort by a value, then by relevance, then by another
> value?  I was unable to find a way to do this.

There isn't.

When I was writing Xapian::Sorter, I contemplated passing it the
document relevance weight to allow this, but that would mean we'd have
to always calculate the weight before calling the Sorter (currently we
delay doing so until we need it, which we often don't at this point) or
have an "I use the weight" method on Sorter which you could use to get
passed the weight.

If you were passed the weight, you could use sortable_serialise() to
build it into the generated key

But since I didn't actually have a scenario where this would be useful,
I avoided over-complicating things.  How are you hoping to use it?

Cheers,
    Olly