HTTP和日期范围上的Riak SOLR?

HTTP和日期范围上的Riak SOLR?,solr,riak,riak-search,riak-cs,Solr,Riak,Riak Search,Riak Cs,有人能告诉我Riak在使用HTTP上的SOLR api进行搜索时对日期格式的期望吗?我有一些被索引的数据。通配符搜索确认: { "responseHeader": { "status": 0, "QTime": 13, "params": { "q": "*", "q.op": "or", "filter": "", "wt": "json"

有人能告诉我Riak在使用HTTP上的SOLR api进行搜索时对日期格式的期望吗?我有一些被索引的数据。通配符搜索确认:

{
    "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": {}
            }
        ]
    }
}
我还确认了我的模式将_dt作为日期时间:

%% Field names ending in "_dt" are indexed as dates
        {dynamic_field, [
            {name, "*_dt"},
            {type, date},
            {analyzer_factory, {erlang, text_analyzers, noop_analyzer_factory}}
        ]},
我尝试了很多变化,包括:

/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

我被难住了,而且日期范围的文档有点缺乏。。有人用过这个吗?转换为历元日期时间是否受阻?

日期字段使用noop分析器,因此索引文本将与您存储的文本完全相同。但是,冒号是查询中的活动字符,因此需要在值中转义:

% curl localhost:8098/buckets/testbucket/keys/1 -XPUT -H "content-type: application/json" \
  -d '{"item":"1","stamp_dt":"2014-06-06T02:10:35.367Z"}'
% curl localhost:8098/buckets/testbucket/keys/2 -XPUT -H "content-type: application/json" \
  -d '{"item":"2","stamp_dt":"2014-06-07T02:10:35.367Z"}'
% curl localhost:8098/buckets/testbucket/keys/3 -XPUT -H "content-type: application/json" \
  -d '{"item":"3","stamp_dt":"2014-06-07T06:10:35.367Z"}'

% curl -g 'localhost:8098/solr/testbucket/select?q=stamp_dt:2014-06-06T02\:10\:35.367Z'
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <lst name="responseHeader">
    <int name="status">0</int>
    <int name="QTime">1</int>
    <lst name="params">
      <str name="indent">on</str>
      <str name="start">0</str>
      <str name="q">stamp_dt:2014-06-06T02\:10\:35.367Z</str>
      <str name="q.op">or</str>
      <str name="filter"></str>
      <str name="df">value</str>
      <str name="wt">standard</str>
      <str name="version">1.1</str>
      <str name="rows">1</str>
    </lst>
  </lst>
  <result name="response" numFound="1" start="0" maxScore="0.353553">
    <doc>
      <str name="id">1
      </str>
      <str name="item">1
      </str>
      <date name="stamp_dt">2014-06-06T02:10:35.367Z
      </date>
    </doc>
  </result>
</response>
%curl localhost:8098/bucket/testbucket/keys/1-XPUT-H“内容类型:应用程序/json”\
-d'{“项目”:“1”,“邮票”:“2014-06-06T02:10:35.367Z”}
%curl localhost:8098/bucket/testbucket/keys/2-XPUT-H“内容类型:application/json”\
-"项目:"2,"邮票:"2014-06-07T02:10:35.367Z"
%curl localhost:8098/bucket/testbucket/keys/3-XPUT-H“内容类型:application/json”\
-d'{“项目”:“3”,“盖章”:“2014-06-07T06:10:35.367Z”}
%curl-g'localhost:8098/solr/testbucket/select?q=stamp\u dt:2014-06-06T02 \:10 \:35.367Z'
0
1.
在…上
0
邮票:2014-06-06T02 \:10 \:35.367Z
或
价值
标准
1.1
1.
1.
1.
2014-06-06T02:10:35.367Z
您选择的日期格式也适用于范围查询(不确定为什么空间必须显式url编码为%20):

%curl-g'localhost:8098/solr/testbucket/select?q=stamp_dt:[2014-06-06%20至%202014-06-07T23 \:59]'
0
4.
在…上
0
印花税:[2014-06-06至2014-06-07T23 \:59]
或
价值
标准
1.1
3.
1.
1.
2014-06-06T02:10:35.367Z
2.
2.
2014-06-07T02:10:35.367Z
3.
3.
2014-06-07T06:10:35.367Z
% curl -g 'localhost:8098/solr/testbucket/select?q=stamp_dt:[2014-06-06%20TO%202014-06-07T23\:59]'
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <lst name="responseHeader">
    <int name="status">0</int>
    <int name="QTime">4</int>
    <lst name="params">
      <str name="indent">on</str>
      <str name="start">0</str>
      <str name="q">stamp_dt:[2014-06-06 TO 2014-06-07T23\:59]</str>
      <str name="q.op">or</str>
      <str name="filter"></str>
      <str name="df">value</str>
      <str name="wt">standard</str>
      <str name="version">1.1</str>
      <str name="rows">3</str>
    </lst>
  </lst>
  <result name="response" numFound="3" start="0" maxScore="0.00000e+0">
    <doc>
      <str name="id">1
      </str>
      <str name="item">1
      </str>
      <date name="stamp_dt">2014-06-06T02:10:35.367Z
      </date>
    </doc>
    <doc>
      <str name="id">2
      </str>
      <str name="item">2
      </str>
      <date name="stamp_dt">2014-06-07T02:10:35.367Z
      </date>
    </doc>
    <doc>
      <str name="id">3
      </str>
      <str name="item">3
      </str>
      <date name="stamp_dt">2014-06-07T06:10:35.367Z
      </date>
    </doc>
  </result>
</response>