Can anyone tell me what Riak expects for date format when using the SOLR api over HTTP to search? I have some data that's indexed. A wildcard search confirms that:
{
"responseHeader": {
"status": 0,
"QTime": 13,
"params": {
"q": "*",
"q.op": "or",
"filter": "",
"wt": "json"
}
},
"response": {
"numFound": 2,
"start": 0,
"maxScore": "0.00000e+0",
"docs": [
{
"id": "09d1bf74-9cdc-4001-8797-fc5a4b9170b0",
"index": "TestIndex",
"fields": {
"Timestamp_dt": "2014-06-06T02:10:35.367Z"
},
"props": {}
},
{
"id": "09d1bf74-9cdc-4001-8797-fc5a4b9170b0",
"index": "TestIndex",
"fields": {
"Timestamp_dt": "2014-06-08T02:10:35.367Z"
},
"props": {}
}
]
}
}
I've also confirmed my schema is picking up _dt as datetime:
%% Field names ending in "_dt" are indexed as dates
{dynamic_field, [
{name, "*_dt"},
{type, date},
{analyzer_factory, {erlang, text_analyzers, noop_analyzer_factory}}
]},
I've tried a bunch of variations including these:
/solr/TestIndex/select?wt=json&q=Timestamp_dt:[20140508000000%20TO%2020140608000000]
/solr/TestIndex/select?wt=json&q=Timestamp_dt:[20140508T000000Z TO 20140607T000000Z]
/solr/TestIndex/select?wt=json&q=Timestamp_dt:%5B2014-05-08T00%3A00%3A00.000Z%20TO%202014-06-07T00%3A00%3A00.000Z%5D
I'm stumped, and the docs on date ranges are somewhat lacking.. Has anyone gotten this to work? Am I stuck converting to epoch datetimes?
Date fields use the noop analyzer, so the indexed text will be exactly as you stored it. However, the colon is an active character in the query, so you'll need to escape it in the value:
The date format you've chosen also lends itself well to range queries (not sure why the spaces have to be explicitly url-encoded as %20):