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

Yoni Amir commented on SOLR-3814:
---------------------------------

I think this happens because price_c is the destination of a copyField tag, but 
it is also stored.
So on the first post one instance of this field is created.
On the second post (the first update) solr constructs a document with one 
price_c field. Then it applies the copying and creates another such field, and 
it manages to save the document without an error.

On the third post (the second update), when solr loads the document from the 
index, it detects the error.

I'd expect the copy field to override previous values in this case.
However, if price_c was both multi-valued and stored, I don't know what would 
be the correct behavior. I expect that typically it makes sense to delete the 
old values. However, it is possible that some of the values were originally 
posted into that field, rather than copied from other fields ...
                
> Partial document update silently breaks multi-valued constraint
> ---------------------------------------------------------------
>
>                 Key: SOLR-3814
>                 URL: https://issues.apache.org/jira/browse/SOLR-3814
>             Project: Solr
>          Issue Type: Bug
>          Components: update
>    Affects Versions: 4.0-BETA
>         Environment: windows xp, java 6 or 7
>            Reporter: Yoni Amir
>
> 1) Download the tutorial, start solr, and post to it the file solr.xml as 
> explained in the tutorial.
> 2) query *:* and verify that you have one document in solr with id SOLR1000
> 3) copy the xml file and create a partial update command for that document. I 
> used something like this:
> <add>
> <doc>
>   <field name="id">SOLR1000</field>
>   <field name="manu" update="set">new value</field>
> </doc>
> </add>
> 4) Post this document to solr. It will succeed.
> 5) Query *:* again, and you will notice something strange. There is still one 
> document, but in the results the field price_c appears twice, even though it 
> is not a multi-valued field.
> <result name="response" numFound="1" start="0">
>   <doc>
>     <str name="id">SOLR1000</str>
>     ...
>     <float name="price">0.0</float>
>     <arr name="price_c">
>       <str>0.0,USD</str>
>       <str>0,USD</str>
>     </arr>
>   </doc>
> </result>
> 6) change the value in the xml that you just sent (e.g. "new value2") and 
> post it again to solr. Now solr throws an exception:
> SEVERE: org.apache.solr.common.SolrException: ERROR: [doc=SOLR1000] multiple 
> values encountered for non multiValued field price_c
> : [0.0,USD, 0,USD]
>         at 
> org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:242)
>         at 
> org.apache.solr.update.AddUpdateCommand.getLuceneDocument(AddUpdateCommand.java:76)
>         at 
> org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:208)
>         at 
> org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:61)
>         at 
> org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:51)
>         at 
> org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:414)
>         at 
> org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:535)
>         at 
> org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:315)
>         at 
> org.apache.solr.update.processor.LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:100)
>         at 
> org.apache.solr.handler.loader.XMLLoader.processUpdate(XMLLoader.java:230)
>         at org.apache.solr.handler.loader.XMLLoader.load(XMLLoader.java:157)
>         at 
> org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:92)
>         at 
> org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:74)
>         at 
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
>         at org.apache.solr.core.SolrCore.execute(SolrCore.java:1656)
>         at 
> org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:454)
>         at 
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:275)
>         at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1337)
> I am trying to use the partial update feature in my current project, and this 
> is a showstopper for us right now.
> Thanks,
> Yoni

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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

Reply via email to