我在solr面临一个问题。我无法匹配日期 我在solr 5.5工作
以下是我的架构的一部分
http://172.28.128.3:8983/solr/tweets_shard1_replica1/select?q=id:75bfb093-033c-41fa-8712-814f17da7c54
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">7</int>
<lst name="params">
<str name="q">id:75bfb093-033c-41fa-8712-814f17da7c54</str>
</lst>
</lst>
<result name="response" numFound="1" start="0">
<doc>
<date name="timestamp">2014-12-31T21:03:06Z</date>
<str name="lang">und</str>
<str name="timezone">Eastern Time (US & Canada)</str>
<str name="user">startup_owner11</str>
<str name="tweet_text">Wow! $GOOG is going down today #BigData</str>
<str name="id">75bfb093-033c-41fa-8712-814f17da7c54</str>
<long name="_version_">1558697655805149184</long>
</doc>
</result>
</response>
这是我提供查询时的示例数据
http://172.28.128.3:8983/solr/tweets_shard1_replica1/select?q=*:*&fq=timestamp:2014-12-31T21:03:06Z
现在我给出以下查询。我收到了错误
<response>
<lst name="responseHeader">
<int name="status">400</int>
<int name="QTime">1</int>
<lst name="params">
<str name="q">*:*</str>
<str name="fq">timestamp:2014-12-31T21:03:06Z</str>
</lst>
</lst>
<lst name="error">
<lst name="metadata">
<str name="error-class">org.apache.solr.common.SolrException</str>
<str name="root-error-class">org.apache.solr.common.SolrException</str>
</lst>
<str name="msg">Invalid Date String:'2014-12-31T21'</str>
<int name="code">400</int>
</lst>
</response>
以下是solr的回复
private Drawable getDrawableByName(String name) {
return getResources().getDrawable(getResources().getIdentifier(name, "drawable", getPackageName()));
}
请帮忙
答案 0 :(得分:1)
你错过了两件事
timestamp:2014-12-31T21\:03\:06Z
<field name="timestamp" type="timestamp_field" indexed="true" stored="true"/>
重新编制索引并运行查询
http://172.28.128.3:8983/solr/tweets_shard1_replica1/select?q=*:*&fq=timestamp:2014-12-31T21\:03\:06Z
希望这有助于, 维诺德