My Solr schema has a fieldtype tdate
of class solr.TrieDateField
<field name="timestamp" type="tdate" indexed="true" stored="true" default="NOW"/>
So when I add documents to the index the timestamp field looks like this:
"timestamp": "2015-11-03T15:52:51.418Z"
Now to filter all documents of the current year I add a range filter to the query:
/select?q=*:*&fq=timestamp:[NOW/YEAR TO NOW/YEAR+1YEAR}
But how would I filter for any year, let's say 2014?
The only thing I could come up with was to create a date range spanning the entire year from the first to the last millisecond:
/select?q=*%3A*&wt=json&indent=true&fq=timestamp:[2014-01-01T0:00:00.000Z TO 2014-12-31T23:59:59.999Z}
Is there a way to get to the same result by just passing in the year as a four digit string?