You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Alexander Kanarsky <al...@trulia.com> on 2011/06/01 00:34:33 UTC

Re: copyField generates "multiple values encountered for non multiValued field"

Alexander,

I saw the same behavior in 1.4.x with non-multivalued fields when
"updating" the document in the index (i.e obtaining the doc from the
index, modifying some fields and then adding the document with the same
id back). I do not know what causes this, but it looks like the
copyField logic completely bypasses the "multivalueness" check and just
adds the value in addition to whatever already there (instead of
replacing the value). So yes, Solr renders itself into incorrect state
then (note that the index is still correct from the Lucene's
standpoint). 

-Alexander

 


On Wed, 2011-05-25 at 16:50 +0200, Alexander Golubowitsch wrote:
> Dear list,
>  
> hope somebody can help me understand/avoid this.
>  
> I am sending an "add" request with allowDuplicates=false to a Solr 1.4.1
> instance.
> This is for debugging purposes, so I am sending the exact same data that are
> already stored in Solr's index.
> I am using the PHP PECL libraries, which fail completely in giving me any
> hint on what goes wrong.
> 
> Only sending the same "add" request again gives me a proper
> "SolrClientException" that hints:
>  
> ERROR: [288400] multiple values encountered for non multiValued field
> "field2" [fieldvalue, fieldvalue]
> 
> The scenario:
> - "field1" is implicitly single value, type "text", indexed and stored
> - "field2" is generated via a copyField directive in schema.xml, implicitly
> single value, type "string", indexed and stored
> 
> What appears to happen:
> - On the first "add" (SolrClient::addDocuments(array(SolrInputDocument
> theDocument))), regular fields like "field1" get overwritten as intended
> - "field2", defined with a copyField, but still single value, gets
> _appended_ instead
> - When I retrieve the updated document in a query and try to add it again,
> it won't let me because of the inconsistent multi-value state
> - The PECL library, in addition, appears to hit some internal exception
> (that it doesn't handle properly) when encountering multiple values for a
> single value field. That gives me zero results querying a set that includes
> the document via PHP, while the document can be retrieved properly, though
> in inconsistent state, any other way.
> 
> But: Solr appears to be generating the corrupted state itsself via
> copyField?
> What's going wrong? I'm pretty confused...
> 
> Thank you,
>  Alex
>