lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <>
Subject RE: Numeric Range Query
Date Thu, 02 Dec 2010 11:44:57 GMT
The reason is speed. Lucene uses a different technique to index numeric
values (and Dates are also numeric values), so a range query does not need
to enumerate all distinct values in the index between the bounds which makes
TermRangeQuery very slow.

You can index the UNIX epoch returned by Date#getTime() as LONG. To use a
different precision, you can divide the long and index as int (e.g div
86400000 to get full days). Or use techniques like explained in LIA2.


Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen

> -----Original Message-----
> From: Romi []
> Sent: Thursday, December 02, 2010 12:08 PM
> To:
> Subject: Numeric Range Query
> I read that for handling date range query NumericRangeQuery is better than
> TermRangeQuery in "Lucene in action", But i couldnot find the reason. i
> to know the reason behind it. I used TermRangeQuery and
> NumericRangequery both for handling date range query and i found that
> searching is fast via NumericRangeQuery.
> My second point is to query using NumericRangeQuery i have to create
> indexes using NumericField by which i can create indexes upto milisecond
> but what if i want to reduce my resolution upto hour or day.
> --
> View this message in context:
> tp2005303p2005303.html
> Sent from the Lucene - General mailing list archive at

View raw message