I can recommend this method, this is how we do it, but what we store in
the index is the long converted to a 16 digit number hex. The extended
parser converts entered queries containing longs field to have hex. We
obviously also do the conversion before we display the value. Floating
point numbers are more difficult and so far I have used the same
technique to do fixed position floats.

Mike

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chris Hostetter
Sent: 24 January 2006 22:37
To: java-user@lucene.apache.org
Subject: Re: Range queries


: As Gwyn pointed out, that would make -3 > -2.   Personally, I'd use
: unsigned numbers and shift the range -- for 16 bit numbers I'd map
: -32768..32767 to 0..65535 by adding 32768.  I guess you could do that
by
: having overriding getRangeQuery() (LIA, p207 -- wonderful book).

there are a lot of different techniques for encoding numeric values as
lexigraphically ordered strings, finding the right soluation for any
given case depends mainly on what hte scope of your values is -- if
you're only ever dealing with the numbers 1-10, there are some really
easy options.  If you want something that can handle any "long" take a
look at the NumberTools class in SVN.  Even if what you want is
something
that can handle any int, the technique used in that class can be still
be
applied.


As for the query parsing aspect -- subclassing and overriding the
getRangeQuery method to know which fields to encode using your method of
choice is the very easy to do.


-Hoss


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


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

Reply via email to