lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: Regarding range queries.
Date Tue, 09 Aug 2005 14:27:40 GMT

On Aug 9, 2005, at 2:27 AM, santo santo wrote:

> Hi all,
> I am new user of lucene. This query is posted at least
> once on alomost all lucene mailing lists. The query
> being about handling of date fields.
> In my case I need to find documents with dates older
> than a particular date. So ideally I am not supposed
> to specify the lower bound. When using the default
> date handling provdied by lucene in conjunction with
> the RangeQuery, it results in a havaoc.

Could you elaborate on the havoc you've experienced?

> But recently during my search for a solution to this
> problem I came across a solution  which said to
> convert the dates to string format of the form
> YYYY:MM:DD. This is beacuse - "Lucene can handle
> String ranges without having to add every possible
> value as a comparison clause". Here is the link

> Now my question is:-
> (1) Is the above statement true?
> (2) If yes will it work with YYYY:MM:DD HH:MM:SS
> format  too?

Yes, and yes.  You still have to watch out for the TooManyClauses  
exception when doing a plain RangeQuery, but there is now a  
RangeFilter available to help with this situation (which may require  
changing how you construct Query objects in some way).

You need to ensure that the string representation of any terms used  
for range queries be in lexicographical order.  Every term in Lucene  
is essentially a string.

Hope this helps some.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message