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 Leos Literak <li...@seznam.cz> on 2005/07/06 17:29:22 UTC

no results for date field

Hi,

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.

Thanks

Leos


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


Re: no results for date field

Posted by Leos Literak <li...@seznam.cz>.
Erik Hatcher napsal(a):
> 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.

this one works in Czech:

created:[1.7.2005 TO 7.7.2005]

thanks


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


Re: no results for date field

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
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,  
Date)?

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.

     Erik


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