lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reece.1247...@bloglines.com
Subject Re: Range searches for numbers
Date Thu, 06 May 2004 17:46:52 GMT
Thanks for the info.  The Date formatter doesn't work because it can only
deal with positive longs.  My problem was how to handle the negatives but
I got it figured out.

Thanks!

--- Lucene Users List" <lucene-user@jakarta.apache.org
wrote:
Quick reference:
> 
> http://wiki.apache.org/jakarta-lucene/SearchNumericalFields

> 
> If you are stuck, you can always encode the long in a string format
(the 
> date formatter in lucene might do this already). Or even, you could
also 
> treat it like a date and use your long like a date filter.
> 
>
HTH,
> sv
> 
> On 6 May 2004 Reece.1247688@bloglines.com wrote:
> 
>
> Hi,
> > 
> > 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!
> > 
> > -Reece

> > 
> > ---------------------------------------------------------------------

> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
> 
> 
> 
> ---------------------------------------------------------------------

> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For
additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message