lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Syntax for Numeric Range
Date Thu, 03 Feb 2011 16:22:25 GMT
Hi Anuj,

You have to subclass QueryParser and override newRangeQuery() to parse
yourself. Automatic parsing is impossible, because QueryParser does not know
(in contrast to Apache Solr) which fields have which type (Lucene has no
field schema). 

Example how to do this:
http://mail-archives.apache.org/mod_mbox/lucene-java-user/200910.mbox/%3CBLU
140-W22F12E1C9AC650580E9852D0BE0@phx.gbl%3E

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Anuj Shah [mailto:anujshahwork@gmail.com]
> Sent: Thursday, February 03, 2011 4:50 PM
> To: java-user@lucene.apache.org
> Subject: Syntax for Numeric Range
> 
> Is there a query syntax for specifying a numeric range for a field indexed
as a
> NumericField.
> 
> I've tried
> 
> numericfield:[0 TO 10]
> >
> 
> But it is parsed as a TermRangeQuery and not a NumericRangeQuery.
> 
> Many thanks
> 
> Anuj


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


Mime
View raw message