[Xapian-discuss] sorting question
Jim Spath
jspath at pangeamedia.com
Wed Jul 22 17:55:35 BST 2009
Olly Betts wrote:
> 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
Currently our default sort is by relevance then date.
We were considering adding a value, which, if true, would make items
appear first, but still maintain the old default sort after that.
So it would be:
"push to top value" => relevance => date
But, we have actually abandoned this idea for other reasons, so it's no
longer an issue.
Thanks for the reply!
- Jim
More information about the Xapian-discuss
mailing list