>> 2. How do I search for negative numbers in a range. For example  
>> field:[-3 TO
>> 2] ?
>>
>> I don't mind hacking code such that my numbers are indexed as  
>> +00000001 and
>> -00000001 and then I can override the query parser to change my  
>> query to
>> [-0000003 TO +0000002]. However.. "+" is less then "-" in Ascii  
>> terms so a
>> range search isn't going to work terrifically well.. Is there a  
>> standard
>> approach??
>
>You could leave the "+" off for positive numbers.  That'd do the  
>trick, right?  "-" < "0" lexicographically.
>
>       Erik

Hi Erik, 

good point! Of course it still doesn't work because "-3" is greater then
"-2" !

I've done something else where 0 is represented by 10000000000000000000
Any positive number has a "1" followed by the number left padded with zeroes
to length 19 

12345 is therefore 10000000000000012345

Any negative number has a "0" followed by (number - long.minvalue) left
padded with zeroes to length 19

-12345 is therefore 09223372036854763463

This will work fine. Of course it got much more difficult with floating
numbers where you have to mess around with a positive and negative mantissa
and exponent. But it was doable.

-g


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to