msokolov commented on a change in pull request #172:
URL: https://github.com/apache/lucene/pull/172#discussion_r646532102



##########
File path: lucene/core/src/java/org/apache/lucene/codecs/VectorWriter.java
##########
@@ -104,9 +104,12 @@ private void mergeVectors(FieldInfo mergeFieldInfo, final 
MergeState mergeState)
         }
       }
     }
-    // Create a new VectorValues by iterating over the sub vectors, mapping 
the resulting
-    // docids using docMaps in the mergeState.
-    if (subs.size() > 0) {
+    if (subs.size() == 0) {
+      // all segments being merged have no vectors
+      writeField(mergeFieldInfo, VectorValues.EMPTY);
+    } else {
+      // Create a new VectorValues by iterating over the sub vectors, mapping 
the resulting
+      // docids using docMaps in the mergeState.
       writeField(mergeFieldInfo, new VectorValuesMerger(subs, mergeState));
     }

Review comment:
       Oh about your first point, that was bothering me too. Perhaps it can 
never happen (hidden as you say by this earlier bug, and now by this fix), but 
I agree, we should write the metadata unconditionally there.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to