[Xapian-discuss] Changing order policy

Olly Betts olly at survex.com
Sun Mar 20 14:18:52 GMT 2011


On Tue, Mar 15, 2011 at 09:27:04AM +0000, The Craic Finder wrote:
> Maybe I'm going to ask a bit weird question:
> 
> I have an item collection, most of them are writting with latin letters, but
> some of them have chinese letters. There is a list page and numbers,
> punctuation and chinese letters go first. I would like to change this order
> policy in order to show first items that start with latin letters, and then
> numbers, punctuation and chinese letters,
> 
> Is there a way to change the query order policy in Xapian?

Are you talking about ordering of results?  I.e. Xapian::Enquire's
set_sort_by_value() method.

If so, then you need to adjust the strings so they sort (by raw byte
comparisons) in the order you want.  You can either do this at index
time and alter the values you set, or do it at search time with a
subclass of Xapian::KeyMaker.

Cheers,
    Olly



More information about the Xapian-discuss mailing list