0

I want to make a search for SOLR documents for a specific date.

I found doc page (https://cwiki.apache.org/confluence/display/solr/Working+with+Dates) that says I can just specify the date like 2016-11-23 and it should search for all documents on this specific date.

I also found a Stackoverflow question that states the same How to filter query in solr by date?

But when I try it in the SOLR update panel I always get "Invalid Date String:'2016-11-23'"

What I wanted to know now: is it possible to use the dates in this format without time or do I have to provide the whole datetime string always?

Community
  • 1
  • 1
ChristophE
  • 760
  • 1
  • 9
  • 21

1 Answers1

3

The examples from the format above is valid for fields of the type DateRangeField only, and not for regular date fields.

The easiest way to work around this for regular date fields is to append T00:00:00Z to your range:

fq=date:[2016-11-23T00:00:00Z TO 2016-11-24T00:00:00Z}

The reason for using } is that you don't want to include documents with 00:00:00 the following day.

MatsLindh
  • 49,529
  • 4
  • 53
  • 84