DateType Solr索引错误

时间:2013-12-30 13:00:40

标签: datastax-enterprise

我使用的是DSE 3.2.0。当我尝试在Solr中索引一个DateType列(系统区域设置是GMT + 3)时,我得到以下SOLR异常:

org.apache.solr.common.SolrException: org.apache.solr.common.SolrException: Invalid Date String:'2013-10-10 23:59:59+0300'
at com.datastax.bdp.cassandra.index.solr.CassandraDirectUpdateHandler2.deleteByQuery(CassandraDirectUpdateHandler2.java:230)
at com.datastax.bdp.cassandra.index.solr.AbstractSolrSecondaryIndex.doDelete(AbstractSolrSecondaryIndex.java:628)
at com.datastax.bdp.cassandra.index.solr.Cql3SolrSecondaryIndex.updateColumnFamilyIndex(Cql3SolrSecondaryIndex.java:138)
at com.datastax.bdp.cassandra.index.solr.AbstractSolrSecondaryIndex$3.run(AbstractSolrSecondaryIndex.java:896)
at com.datastax.bdp.cassandra.index.solr.concurrent.IndexWorker.run(IndexWorker.java:38)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.apache.solr.common.SolrException: Invalid Date String:'2013-10-10 23:59:59+0300'
at org.apache.solr.schema.DateField.parseMath(DateField.java:182)
at org.apache.solr.analysis.TrieTokenizer.reset(TrieTokenizerFactory.java:135)
at org.apache.solr.parser.SolrQueryParserBase.newFieldQuery(SolrQueryParserBase.java:409)
at org.apache.solr.parser.SolrQueryParserBase.getFieldQuery(SolrQueryParserBase.java:959)
at org.apache.solr.parser.SolrQueryParserBase.getFieldQuery(SolrQueryParserBase.java:574)
at org.apache.solr.parser.SolrQueryParserBase.handleQuotedTerm(SolrQueryParserBase.java:779)

下面的架构:

<schema name="mach" version="1.1">
<types>
    <fieldType name="string" class="solr.StrField"/>
    <fieldType name="int" class="solr.TrieIntField"/>
    <fieldType name="date" class="solr.TrieDateField"/>
 </types>
 <fields>
    <field name="snapshot_date" type="date" indexed="true"  stored="true"/>
    <field name="account_id" type="string" indexed="true"  stored="true"/>
    <field name="account_type" type="string" indexed="true"  stored="true" />
  </fields>
  <uniqueKey>(snapshot_date, account_id)</uniqueKey>
  <defaultSearchField>account_id</defaultSearchField>
 </schema>

2 个答案:

答案 0 :(得分:4)

Solr使用ISO日期格式的特定子集:YYYY-MM-DDThh:mm:ssZ或最后的ss.tttZ,抑制任何尾随零。仅支持GMT(“Z”)。

因此,您的“2013-10-10 23:59:59 + 0300”的值应表示为“2013-10-10T20:59:59Z”。

答案 1 :(得分:3)

这是一个影响已删除行重建索引的错误,将在DSE 3.2.3中修复。