lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karthik N S" <kart...@controlnet.co.in>
Subject RE: Range Query Sombody HELP please
Date Thu, 27 May 2004 07:37:12 GMT
Hi
   Lucene -Developer My main intention was

 Search for an word hit  in a Unique Field  between  ranges     say
book100  - book 200  indexed numbers
 It's something like creating a SUBSEARCH  with in the SEARCHINDEX.

  This is similar to a SQL =

     select  *  from BOOKSHELF.
                 or
     select  *  from BOOKSHELF where  book1  between 100 and  200.


with regards
Karthik

-----Original Message-----
From: Ype Kingma [mailto:ykingma@xs4all.nl]
Sent: Thursday, May 27, 2004 12:46 PM
To: lucene-user@jakarta.apache.org
Subject: Re: Range Query Sombody HELP please


On Thursday 27 May 2004 07:00, Karthik N S wrote:
> Hi
> Lucene developers
>
> Is it possible to do Search and retrieve relevant information on the
> Indexed Document
> within in specific range settings which may be  similar to an
>
> Query in SQL  =  select  *  from BOOKSHELF where  book1  between 100 and
> 200
>
> ex:-
>
>        "search_word"  ,   Book between  100   AND   200
>
> [ Note:- where Book uniquefield  hit info which is already Indexed ]

The query parser can construct this query for you (assuming search_word
is in the query default field):

+search_word +(book:[100 TO 200])

See also: http://jakarta.apache.org/lucene/docs/queryparsersyntax.html

One problem you might run into is that Lucene does not support numbers
directly, only strings are indexed. You can index these numbers with
sufficient
zero's prefixed and add these prefix zero's in the query.

Erik Hatcher wrote an article on how to do make the query:
http://today.java.net/pub/a/today/2003/11/07/QueryParserRules.html
You'll need to override the getRangeQuery() method.

Have fun,
Ype


---------------------------------------------------------------------
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