djapian converts integer and float values in string (convert method in
indexer.py). so ordering by an integer we get for ex: 1,10,100,10001,2,3,4...
and we expect 1,2,3,4,10,100,10001.
there is a solution in http://xapian.org/docs/sorting.html
You can order documents by comparing a specified document value. Note that
the comparison used compares the byte values in the value (i.e. it's a
string sort ignoring locale), so 1 < 10 < 2. If you want to encode the
value such that it sorts numerically, use Xapian::sortable_serialise() to
encode values at index time - this works equally will on integers and
floating point values:
Xapian::Document doc;
doc.add_value(0, Xapian::sortable_serialise(price));
Original issue reported on code.google.com by sforne...@gmail.com on 10 Oct 2009 at 9:11
Original issue reported on code.google.com by
sforne...@gmail.com
on 10 Oct 2009 at 9:11