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 Wed, 20 Oct 2004 14:36:05 GMT
Karthik,

It is all spelled out in a Lucene HowTo here:
http://wiki.apache.org/jakarta-lucene/SearchNumericalFields

Have fun with it,

Chuck

  > -----Original Message-----
  > From: Karthik N S [mailto:karthik@controlnet.co.in]
  > Sent: Wednesday, October 20, 2004 12:15 AM
  > To: Lucene Users List; Jonathan Hager
  > Subject: RE: Range Query
  > 
  > Hi
  > 
  >    Jonathan
  > 
  > 
  >   "When searching I also pad the query term" ???
  > 
  >    When Exactly are u handling this  [ using During Indexing Process
  > Also or
  > while  Search on Process Only  ]
  > 
  >    Can u be Please  be specific.............
  > 
  >    [  if time permits and possible please can u send me the sample
Code
  > for
  > the same ]
  > 
  >    . :)
  > 
  > 
  >  Thx in advance
  > 
  > 
  > -----Original Message-----
  > From: Jonathan Hager [mailto:jhager@gmail.com]
  > Sent: Wednesday, October 20, 2004 3:31 AM
  > To: Lucene Users List
  > Subject: Re: Range Query
  > 
  > 
  > That is exactly right.  It is searching the ASCII.  To solve it I
pad
  > my price using a method like this:
  > 
  >   /**
  >    * Pads the Price so that all prices are the same number of
characters
  > and
  >    * can be compared lexigraphically.
  >    * @param price
  >    * @return
  >    */
  >   public static String formatPriceAsString(Double price) {
  >     if (price == null) {
  >       return null;
  >     }
  >     return PRICE_FORMATTER.format(price.doubleValue());
  >   }
  > 
  > where PRICE_FORMATTER contains enough digits for your largest
number.
  > 
  >   private static final DecimalFormat PRICE_FORMATTER = new
  > DecimalFormat("0000000.00");
  > 
  > When searching I also pad the query term.  I looked into hooking
into
  > QueryParser, but since the lower/upper prices for my application are
  > different inputs, I choose to handle them without hooking into the
  > QueryParser.
  > 
  > Jonathan
  > 
  > 
  > On Tue, 19 Oct 2004 12:35:06 +0530, Karthik N S
  > <karthik@controlnet.co.in> wrote:
  > >
  > > 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
  > 
  > 
  >
---------------------------------------------------------------------
  > 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