You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by is...@apache.org on 2017/01/25 10:59:09 UTC

[11/12] lucene-solr:jira/solr-5944: SOLR-5944: Adding an upfront schema check for version field

SOLR-5944: Adding an upfront schema check for version field


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/3a39dcb8
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/3a39dcb8
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/3a39dcb8

Branch: refs/heads/jira/solr-5944
Commit: 3a39dcb854af2da72916f44807ffbf868b8fec61
Parents: fcf71e3
Author: Ishan Chattopadhyaya <is...@apache.org>
Authored: Wed Jan 25 16:23:52 2017 +0530
Committer: Ishan Chattopadhyaya <is...@apache.org>
Committed: Wed Jan 25 16:23:52 2017 +0530

----------------------------------------------------------------------
 .../solr/update/processor/AtomicUpdateDocumentMerger.java    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3a39dcb8/solr/core/src/java/org/apache/solr/update/processor/AtomicUpdateDocumentMerger.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/processor/AtomicUpdateDocumentMerger.java b/solr/core/src/java/org/apache/solr/update/processor/AtomicUpdateDocumentMerger.java
index f5e5d0a..4c843ad 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/AtomicUpdateDocumentMerger.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/AtomicUpdateDocumentMerger.java
@@ -156,9 +156,15 @@ public class AtomicUpdateDocumentMerger {
     
     final SchemaField uniqueKeyField = schema.getUniqueKeyField();
     final String uniqueKeyFieldName = null == uniqueKeyField ? null : uniqueKeyField.getName();
-    
+
     final Set<String> candidateFields = new HashSet<>();
 
+    // if _version_ field is not supported for in-place update, bail out early
+    SchemaField versionField = schema.getFieldOrNull(DistributedUpdateProcessor.VERSION_FIELD);
+    if (versionField == null || !isSupportedFieldForInPlaceUpdate(versionField)) {
+      return Collections.emptySet();
+    }
+    
     // first pass, check the things that are virtually free,
     // and bail out early if anything is obviously not a valid in-place update
     for (String fieldName : sdoc.getFieldNames()) {