Skip to content

Apache Lucene open-source search software

SOLR-2423 -- checking doc.getFieldable avoids unnecessary toString and plays nicer with binary fields

Ryan McKinley0655899487ec
diff --git a/solr/src/java/org/apache/solr/update/DocumentBuilder.java b/solr/src/java/org/apache/solr/update/DocumentBuilder.java
index 8b099733d92..86108c60d1a 100644
--- a/solr/src/java/org/apache/solr/update/DocumentBuilder.java
+++ b/solr/src/java/org/apache/solr/update/DocumentBuilder.java
@@ -269,7 +269,7 @@ public class DocumentBuilder {
for (CopyField cf : copyFields) {
SchemaField destinationField = cf.getDestination();
// check if the copy field is a multivalued or not
- if (!destinationField.multiValued() && out.get(destinationField.getName()) != null) {
+ if (!destinationField.multiValued() && out.getFieldable(destinationField.getName()) != null) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"ERROR: "+getID(doc, schema)+"multiple values encountered for non multiValued copy field " +
destinationField.getName() + ": " + v);