: This is for debugging purposes, so I am sending the exact same data that are : already stored in Solr's index. ... : 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 ... : But: Solr appears to be generating the corrupted state itsself via : copyField? : What's going wrong? I'm pretty confused...
I think you are missunderstanding the error you are seeing. Solr isn't creating any inconsistent state, the multiValued check does in fact happen after the copyFields. Based on your description, this is what it sounds to me like you are doing and why you are getting your error... Initially sending solr a doc that looks like this... id=1; field1=fieldvalue ...which when copyFields are evaluated winds up looking like this... id=1; field1=fieldvalue; field2=fieldvalue ...that document goes in the index, and you then execute a query that matches it, and fetch the stored values of that document from solr -- getting all three fields back (ie, field1, field2). You then attempt to index that document again, sending all 3 fields... id=1; field1=fieldvalue; field2=fieldvalue ...which when copyFields are evaluated winds up looking like this... id=1; field1=fieldvalue; field2=fieldvalue; field2=fieldvalue ..and that's why you get the error you are seeing. If i'm missunderstanding your "retrieve the updated document in a query and try to add it again" process, can you please provide some example configs and the exact steps to reproduce (using the post.jar, or curl, or something simple that doesn't require PECL) -Hoss