lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: no results for date field
Date Wed, 06 Jul 2005 16:07:08 GMT

On Jul 6, 2005, at 11:29 AM, Leos Literak wrote:
> I've added to index date field:
>     public Field setCreated(Date date) {
>         Field field = Field.Keyword(CREATED, date);
>         document.add(field);
>         return field;
>     }
> Now I try to search according to documentation:
> created:[20040101 TO 20050707]
> But there is no hit. Using luke I realized, that
> this field has such most frequent values:
> 0d0xug8go
> 0cl92izmg
> etc.
> What am I doing wrong? Is syntax for date range queries
> locale specific? I have not found an answear from documentation
> or google search.

What documentation shows that syntax when using Field.Keyword(String,  

QueryParser attempts to parse the from and to strings as simple date  
formats with the default locale.  You would use something like  
"created:[01/01/04 TO 07/05/05]".

Please read up on the issues that the default date handling poses  
though.  Simply indexing with YYYYMMDD format is generally a better  
way to go, though you will need to adjust for this to handle range  
queries with QueryParser.  Lots of details of the date issues are in  
Lucene in Action and some details on the wiki too I believe.


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

View raw message