Solr 索引:日期字段(空)无值
我的 SOlr 架构中有以下字段定义
name="DvdReleaseDate" type="date " stored="true" required="false"
我的输入 xml 文件包含带有 DVDReleaseDate 的电影名称。因此,对于全新版本,此字段为空(也称为 null) 现在,当我索引时,SOLR 抛出空值异常。
我的其他选择是什么?
基本上,我需要支持基于 DVDRelease 日期和日期的查询。同时,空值是有效的用例。
根据反馈编辑我的问题:
我在 solr 架构
字段 name="dvdReleaseDate" type="date"stored="true" required="false"
中有以下内容,异常详细信息是
HTTP ERROR 400 访问 solr 更新时出现问题。 原因:无效的日期字符串:''
Sep 8, 2011 9:14:22 AM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: Invalid Date String:''
at org.apache.solr.schema.DateField.parseMath(DateField.java:165)
at org.apache.solr.schema.TrieDateField.createField(TrieDateField.java:169)
at org.apache.solr.schema.SchemaField.createField(SchemaField.java:98)
at org.apache.solr.update.DocumentBuilder.addField(DocumentBuilder.java:204)
at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:277)
at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:60)
at org.apache.solr.handler.XMLLoader.processUpdate(XMLLoader.java:147)
at org.apache.solr.handler.XMLLoader.load(XMLLoader.java:77)
at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:55)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1360)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:356)
I have the following field definition in my SOlr Schema
name="DvdReleaseDate" type="date " stored="true" required="false"
My input xml file contains movie names with DVDReleaseDate. So for brand new releases, this field in empty (aka null)
Now when I am indexing, SOLR was throwing empty value exception.
What are my other alternatives?
Basically, I need to support queries based on DVDRelease date & at the same time, empty values are valid use case.
Editing my question based on feedback:
I have following in the solr schema
field name="dvdReleaseDate" type="date" stored="true" required="false"
Exception details are
HTTP ERROR 400
Problem accessing solr update.
Reason: Invalid Date String:''
Sep 8, 2011 9:14:22 AM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: Invalid Date String:''
at org.apache.solr.schema.DateField.parseMath(DateField.java:165)
at org.apache.solr.schema.TrieDateField.createField(TrieDateField.java:169)
at org.apache.solr.schema.SchemaField.createField(SchemaField.java:98)
at org.apache.solr.update.DocumentBuilder.addField(DocumentBuilder.java:204)
at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:277)
at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:60)
at org.apache.solr.handler.XMLLoader.processUpdate(XMLLoader.java:147)
at org.apache.solr.handler.XMLLoader.load(XMLLoader.java:77)
at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:55)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1360)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:356)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加不带 dvdReleaseDate 的文档时,请勿在 XML 文档中包含该字段。
例如,代替:
做:
When adding the document without dvdReleaseDate, don't include the field in the XML document.
E.g. instead of:
do: