[Xapian-discuss] Sorting by value - direction

Andrew Betts andrew at trib.tv
Tue Mar 5 10:58:15 GMT 2013


Hi,

I'm trying to sort a list of results alphabetically, but it's coming out in the wrong direction.  Indexing is done like this (PHP bindings):

// Tag name as a value (for sorting)
$doc->add_value(2, strtolower($obj->tag));

And searching like this:

$enquire->set_sort_by_value(2);

But for some reason, the results are coming out Z-A, not A-Z.  I've tried setting true as the second argument to set_sort_by_value, even though we shouldn't need to reverse the direction because a standard sort should produce the right order already.  But even setting the second argument to true, I still get Z-A.

Using delve I can see the value (slot 2) is set correctly:

# delve -r 25 -V tags
Values for record #25: 1:? 2:finance
Term List for record #25: [snip]

Any ideas?

Andrew



More information about the Xapian-discuss mailing list