lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Range searches for numbers
Date Thu, 06 May 2004 08:27:35 GMT

What's the best way to store numbers for range searching?  If someone
has some info about this I'd love to see it.

This is my current plan:
When I convert the number to a string I will zero pad it so range searches
work.  The conversions will be like this for integers:
   1 to 10000000001

   2 to 10000000002
1000 to 10000001000

I'm just adding a "1" to the
start of the string (or adding 1000000000).  This is so negative numbers work
too!  They will just be subtracted from a long (1000000000):
   -1 to 09999999999

   -2 to 09999999998
-1000 to 09999999000

This works great for range
searches.  But how do I convert negative longs?  I can't subtract 1000000000000000000
from a long can I?  It too big to fit in another long.

Any advice is appreciated!


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message