You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Luc Vanlerberghe (JIRA)" <ji...@apache.org> on 2015/10/05 13:52:27 UTC

[jira] [Comment Edited] (SOLR-8050) Partial update on document with multivalued date field fails

    [ https://issues.apache.org/jira/browse/SOLR-8050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14943265#comment-14943265 ] 

Luc Vanlerberghe edited comment on SOLR-8050 at 10/5/15 11:52 AM:
------------------------------------------------------------------

As I mentioned in the code comments, not only is TrieField.createField not able to make sense of the output of Date.toString() as opposed to a correctly formed UTC date/time string (like "1986-01-01T00:00:00Z"), but the value the Date object contains depends on the locale the test is run in, so there must be an error even earlier in the update logic while decoding the values in the Lucene Document...


was (Author: lvl):
As I mentioned in the code comments, not only does TrieField.createField cannot make sense of the output of Date.toString() as opposed to a correctly formed UTC date/time string (like "1986-01-01T00:00:00Z"), but the value the Date object contains depends on the locale the test is run in, so there must be an error even earlier in the update logic while decoding the values in the Lucene Document...

> Partial update on document with multivalued date field fails
> ------------------------------------------------------------
>
>                 Key: SOLR-8050
>                 URL: https://issues.apache.org/jira/browse/SOLR-8050
>             Project: Solr
>          Issue Type: Bug
>          Components: clients - java, SolrJ
>    Affects Versions: 5.2.1
>         Environment: embedded solr
> java 1.7
> win
>            Reporter: Burkhard Buelte
>         Attachments: screenshot-1.png
>
>
> When updating a document with multivalued date field Solr throws a exception
>     like: org.apache.solr.common.SolrException: Invalid Date String:'Mon Sep 14 01:48:38 CEST 2015'
> even if the update document doesn't contain any datefield.
> See following code snippet to reproduce 
> 1. create a doc with multivalued date field (here dynamic field _dts)
>         SolrInputDocument doc = new SolrInputDocument();
>         String id = Long.toString(System.currentTimeMillis());
>         System.out.println("testUpdate: adding test document to solr ID=" + id);
>         doc.addField(CollectionSchema.id.name(), id);
>         doc.addField(CollectionSchema.title.name(), "Lorem ipsum");
>         doc.addField(CollectionSchema.host_s.name(), "yacy.net");
>         doc.addField(CollectionSchema.text_t.name(), "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
>         doc.addField(CollectionSchema.dates_in_content_dts.name(), new Date());
>         solr.add(doc);
>         solr.commit(true);
> 2. update any field on this doc via partial update
>         SolrInputDocument sid = new SolrInputDocument();
>         sid.addField(CollectionSchema.id.name(), doc.getFieldValue(CollectionSchema.id.name()));
>         sid.addField(CollectionSchema.host_s.name(), "yacy.yacy");
>         solr.update(sid);
>         solr.commit(true);
> Result
> Caused by: org.apache.solr.common.SolrException: Invalid Date String:'Mon Sep 14 01:48:38 CEST 2015'
> 	at org.apache.solr.util.DateFormatUtil.parseMath(DateFormatUtil.java:87)
> 	at org.apache.solr.schema.TrieField.readableToIndexed(TrieField.java:473)
> 	at org.apache.solr.schema.TrieField.createFields(TrieField.java:715)
> 	at org.apache.solr.update.DocumentBuilder.addField(DocumentBuilder.java:48)
> 	at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:123)
> 	at org.apache.solr.update.AddUpdateCommand.getLuceneDocument(AddUpdateCommand.java:83)
> 	at org.apache.solr.update.DirectUpdateHandler2.addDoc0(DirectUpdateHandler2.java:237)
> 	at org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:163)
> 	at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:69)
> 	at org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:51)
> 	at org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:955)
> 	at org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:1110)
> 	at org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:706)
> 	at org.apache.solr.update.processor.LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:104)
> 	at org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:51)
> 	at org.apache.solr.update.processor.LanguageIdentifierUpdateProcessor.processAdd(LanguageIdentifierUpdateProcessor.java:207)
> 	at org.apache.solr.handler.loader.XMLLoader.processUpdate(XMLLoader.java:250)
> 	at org.apache.solr.handler.loader.XMLLoader.load(XMLLoader.java:177)
> 	at org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:98)
> 	at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:74)
> 	at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)
> 	at org.apache.solr.core.SolrCore.execute(SolrCore.java:2068)
> 	at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:179)
> 	at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:135)
> 	at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:174)
> 	at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:191)
> P.S. the line "solr.update" takes care to create a partial update document, with proper {"set":[fieldname:value]}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org