Hi,

I see why the existing syntax cannot be used to automatically generate a
NumericRange. But, is it possible to extend the QueryParser to include
additional syntax for a numeric range. e.g.

numericfield:[1;10]
>

The user can be trained to use this syntax for certain fields (i.e those
that I know are indexed as NumericField)

Thanks

Anuj





On 3 February 2011 16:22, Uwe Schindler <[email protected]> wrote:

> 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
> [email protected]%3E<http://mail-archives.apache.org/mod_mbox/lucene-java-user/200910.mbox/%3cblu%[email protected]%3E>
>
> Uwe
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: [email protected]
>
>
> > -----Original Message-----
> > From: Anuj Shah [mailto:[email protected]]
> > Sent: Thursday, February 03, 2011 4:50 PM
> > To: [email protected]
> > 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to