You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Terence Lai <tl...@trekspace.com> on 2004/07/23 16:58:37 UTC

RangeQuery on Numeric values

Hi,

I am currently using Lucene 1.4 Final. I want to construct a query that matches a numeric range. I believe that the RangeQuery defined in Lucene API uses the string comparision. It does not work for numeric contents. Does anyone know how to create a numeric range query?

Thanks,
Terence




----------------------------------------------------------
Get your free email account from http://www.trekspace.com
          Your Internet Virtual Desktop!

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


Re: RangeQuery on Numeric values

Posted by Daniel Naber <da...@t-online.de>.
On Friday 23 July 2004 16:58, Terence Lai wrote:

> I am currently using Lucene 1.4 Final. I want to construct a query that
> matches a numeric range. I believe that the RangeQuery defined in Lucene
> API uses the string comparision. It does not work for numeric contents.
> Does anyone know how to create a numeric range query?

RangeQuery works for numbers, too, but you have to store them in the index so 
they are sorted correctly when sorted alphabetically. For example, if your 
numbers are between 0 and 1000 you have to store them as strings "0000" to 
"1000".

Daniel


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


Re: RangeQuery on Numeric values

Posted by Stephane James Vaucher <va...@cirano.qc.ca>.
This might help:

http://wiki.apache.org/jakarta-lucene/SearchNumericalFields

sv

On Fri, 23 Jul 2004, Terence Lai wrote:

> Hi,
>
> I am currently using Lucene 1.4 Final. I want to construct a query that matches a numeric range. I believe that the RangeQuery defined in Lucene API uses the string comparision. It does not work for numeric contents. Does anyone know how to create a numeric range query?
>
> Thanks,
> Terence
>
>
>
>
> ----------------------------------------------------------
> Get your free email account from http://www.trekspace.com
>           Your Internet Virtual Desktop!
>
> ---------------------------------------------------------------------
> 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