lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chuck Williams" <ch...@manawiz.com>
Subject RE: Range Query
Date Tue, 19 Oct 2004 07:01:58 GMT
Range queries use a lexicographic (dictionary) order.  So, assuming all
your values are positive, you need to ensure that the integer part of
each number has a fixed number of digits (pad with leading 0's).  The
fractional part should be fine, although 1.0 will follow 1.  If you have
negative numbers you need to pad an extra 0 on the left of the
positives, start the negatives with -, and invert the magnitude of the
negatives (so they go in the other order).

Your actual example below should work as is, except that 10 will not be
in the range since 10.00 is strictly after 10.  However, this won't work
without the padding assuming you have any prices with at an integer part
of other than exactly two digits (e.g., 10 is before 6, but after 06).

Chuck

  > -----Original Message-----
  > From: Karthik N S [mailto:karthik@controlnet.co.in]
  > Sent: Tuesday, October 19, 2004 12:05 AM
  > To: LUCENE
  > Subject: Range Query
  > 
  > 
  > Hi
  > 
  > Guys
  > 
  > Apologies.........
  > 
  > 
  > 
  > I  have  a Field Type  "Text"  'ItemPrice' ,  Using it to Store  "
Price
  > Factor in numeric " such as  10, 25.25 , 50.00....
  > 
  > If I am suppose to Find the Range factor  between 2   prices
  > 
  > ex -
  >                  Contents:shoes +ItemPrice:[10.00 TO 50.60]
  > 
  > 
  > I get results  other  then the Range that has been  executed   [This
may
  > be
  > due to query parsing the Ascii values instead of  numeric values ]
  > 
  > Am  I am missing something in the Querry syntax  or Is this the
wrong
  > way to
  > construct the Query.
  > 
  > Please Somebody Advise me.... ASAP.....  :(
  > 
  > Thx in advance
  > 
  > 
  > 
  > 
  >       WITH WARM REGARDS
  >       HAVE A NICE DAY
  >       [ N.S.KARTHIK]
  > 
  > 
  > 
  > 
  >
---------------------------------------------------------------------
  > 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