hardik.h
hardik.h

Reputation: 21

Invalid Date exception | SOLR

I am getting an invalid date string exception when searching for indexType:2013-06-26T18:30:00Z TO NOW.

The Stack trace I get is as follows:

Nov 18, 2013 10:19:18 AM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: Invalid Date String:'2013-06-26T18'
    at org.apache.solr.schema.DateField.parseMath(DateField.java:165)
    at org.apache.solr.schema.TrieField.readableToIndexed(TrieField.java:301)
    at org.apache.solr.schema.TrieField.toInternal(TrieField.java:309)

Solr Version: 3.5.0.2011.11.22.14.54.38

Although when I look in the index, it has the date value in absolutely the same pattern, so it is a bit strange.

Thanks in advance.

Upvotes: 2

Views: 3228

Answers (2)

kostia
kostia

Reputation: 334

Well, first of all the easiest, and I guess the proper way, is to set the date range within squared parenthesis []:

indexType:[2013-06-26T18:30:00Z TO NOW]

Another way is the use of escape sequence before each colon like this:

indexType:2013-06-26T18\:30\:00Z TO NOW

Upvotes: 1

Ion Cojocaru
Ion Cojocaru

Reputation: 2583

The query parser interprets your query as

    indexType | 2013-06-26T18
    defaultSearchField | 30
    defaultSearchField | 00Z
    defaultSearchField | TO
    defaultSearchField | NOW

try instead

indexType:[2013-06-26T18:30:00Z TO NOW]

more on Solr query syntax here.

Upvotes: 4

Related Questions