pombreda / djapian

Automatically exported from code.google.com/p/djapian
Other
0 stars 0 forks source link

integer and float fields indexing #88

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago

Original comment by daevaorn on 10 Oct 2009 at 2:34

GoogleCodeExporter commented 9 years ago
Fixed with r299

Original comment by daevaorn on 10 Oct 2009 at 6:53