Solr indexing: date field with (empty) no value
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.j开发者_如何学Pythonava: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)
When adding the document without dvdReleaseDate, don't include the field in the XML document. E.g. instead of:
<add>
<doc>
<field name="id">123</field>
<field name="dvdReleaseDate"></field>
</doc>
</add>
do:
<add>
<doc>
<field name="id">123</field>
</doc>
</add>
精彩评论