[Xapian-discuss] set_sort_by_relevance_then_value() sort order when using float

Olly Betts olly at survex.com
Thu Dec 11 19:57:35 GMT 2008


On Thu, Dec 11, 2008 at 09:25:20AM +0200, Henry wrote:
> Sorting with set_sort_by_relevance_then_value(n) I'm getting the  
> following unexpected behaviour:
> 
> "a" score:100 value(n):0.15
> "b" score:99  value(n):0.15
> "c" score:99  value(n):0
> ...
> [ several matches with score:99, value(n):0 ]
> ...
> "i" score:99  value(n):0.151801582149415   <-- should be ranked second.

Although the percentage score is 99 for both documents, if you look at
the actual weight, I bet that'll be less for this document than the
second one.  And it's the weight which is sorted on when sorting by
relevance.

> value(n) is stored by the indexer with sortable_serialise().
> 
> Is it because value(n) is a float?  I found  
> http://thread.gmane.org/gmane.comp.search.xapian.general/6460/focus=6469 which  
> indicates that serialise_double() cannot be used for sorting.

As my reply two messages later says, serialise_double() isn't an
external API function, but sortable_serialise() is suitable for sorting
floating point values.

Cheers,
    Olly



More information about the Xapian-discuss mailing list