Hi, I'm was sure this discussion has come up before, but after looking around alot I haven't found a suitable answer.
I have a need to index number fields that can be used for sorting and range queries, however the various solutions that I have seen does all have some kind of downside. First of all, I want it to support floating point numbers and negative numbers, and when it comes to negative numbers a simple padding of zeros doesn't do it. Also, I would like the resulting string to only contain printable characters, or at the very least not some special meaning character like the null character. And ofcourse I would like to be able to use the full range of the number type (ie Integer.MIN_VALUE to Integer.MAX_VALUE, and the same for Float and Double). I have seen a few people refering to some Solr code that supposedly solves the problem with negative numbers: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/util/NumberUtils.java?view=markup However, the resulting string contains non-printable characters for most numbers, including the null character. This has given me two problems: 1. When printing out debug messages containing the query, the range query looks like something like this: "field:[€ TO € d]", and I get problems when I try to copy this text from textpad for example, since it complains about the null character. 2. The special case characters are being ignored/removed by most tokenizers so I can't parse the query-string using the regular analyzer that we normally use. Do you have any suggestions on how to solve this in a "neat" way? And is the interest in this really that low (judging from the poor search result I got when searching for "lucene sorting negative numbers" and similar)? I would have thought that the need for this functionallity was quite fundamental, and that it was already part of Lucene core. Regards /Jimi mogul | jimi hullegård | system developer | hudiksvallsgatan 4, 113 30 stockholm sweden | +46 8 506 66 172 | +46 765 27 19 55 | [EMAIL PROTECTED] | www.mogul.com