我在将数据索引到solr时在日志文件中出现以下错误。当我将“Date”信息索引到solr时出现此错误。我正在使用Oracle 10G和solr版本3.5。我认为这里的日期格式可能有误。我查了足够找不到解决方案。以下是我的错误:
date format "'date1'='2012-05-23T09:47:23'"
------
SEVERE: org.apache.solr.common.SolrException: ERROR: [doc=12603] Error adding field 'date1'='2012-05-23T09:47:23'
at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:324)
at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:60)
at org.apache.solr.update.processor.LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:115)
at org.apache.solr.handler.XMLLoader.processUpdate(XMLLoader.java:158)
at org.apache.solr.handler.XMLLoader.load(XMLLoader.java:79)
at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:58)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1398)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:356)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:252)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:212)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.solr.common.SolrException: Invalid Date String:'2012-05-23T09:47:23'
at org.apache.solr.schema.DateField.parseMath(DateField.java:165)
at org.apache.solr.schema.TrieField.createField(TrieField.java:421)
at org.apache.solr.schema.TrieDateField.createField(TrieDateField.java:120)
at org.apache.solr.schema.SchemaField.createField(SchemaField.java:104)
at org.apache.solr.update.DocumentBuilder.addField(DocumentBuilder.java:203)
at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:281)
我身边是否有错误.Plz帮助我......我是solr的新手。
答案 0 :(得分:1)
您似乎错过了Z - i UTC时区,这是强制性的。看起来应该是这样的:
2012-05-23T09:47:23Z
http://lucene.apache.org/solr/api-4_0_0-BETA/org/apache/solr/schema/DateField.html
答案 1 :(得分:0)
{
convertTimestamp {
field :To
inputFormats : ["yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "yyyy-MM-dd'T'HH:mm:ss", "yyyy-MM-dd"]
inputTimezone : UTC
outputFormat : "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
outputTimezone : Europe/London
}
}
如果你正在使用kite-examples-morphlines包中的这段morphlines代码,如果你查看输出格式列,他们就会出错。它应该是" yyyy-MM-dd' HH:mm:ss.SSS' Z'"'希望这可以帮助其他人使用morphlines。