lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From AHMET ARSLAN <iori...@yahoo.com>
Subject Re: date searching?
Date Thu, 22 Oct 2009 16:25:20 GMT
> Hi,
> I'm having a slight problem with date searching...
> I have a document indexed with a date type using the value
> "2007-07-07T00:00:00Z".
> However, when searching - the parser doesn't seem to like
> this.
> How should I be able to search for it?
> 
> In the select query searching for
> "Date:2007-07-07T00:00:00Z" gets me
> an http error 400 and some text:
>     Problem accessing /solr/select. Reason:
>         Invalid Date
> String:'2007-07-07T00'
> 
> Searching for "Date:[2007-07-07T00:00:00Z]" gets me a
> syntax error
> because the parser is looking for a " TO " and another
> date.
> 
> Searching for "Date:[2007-07-07T00:00:00Z TO
> 2007-07-07T00:00:00Z+1DAY]"
> gets me my document back.
> 
> So... is this just a solr bug, or a bug in my search
> syntax?
> Or maybe something incorrect in my schema.xml?  Or
> solrconfig.xml?
> Help please.  :)
>     -Dan

Not it is not a bug.
Chracter : is a part of QueryParser syntax, so you need to escape it.
Try this :
Date:2007-07-07T00\:00\:00Z
or this :
Date:"2007-07-07T00:00:00Z" 

I use the second one since it is easy to insert quotes. 
They both will give you what you want. 


      

Mime
View raw message