jpountz commented on a change in pull request #580:
URL: https://github.com/apache/lucene/pull/580#discussion_r777679243



##########
File path: 
lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90HnswVectorsReader.java
##########
@@ -239,6 +239,9 @@ public TopDocs search(String field, float[] target, int k, 
Bits acceptDocs) thro
     if (fieldEntry == null || fieldEntry.dimension == 0) {
       return null;
     }
+    if (fieldEntry.size() == 0) {

Review comment:
       In other places, we only return `null` when the field doesn't exist or 
doesn't have the feature (vectors in this case) enabled. In other cases, we 
return a non-null value, even when all documents that have a value for the 
field have been merged away. So I think it would be more consistent to return 
an empty instance in this case.
   
   (FWIW the above code that checks `if (fieldEntry == null || 
fieldEntry.dimension == 0)` is dead code since `CodecReader` only forwards the 
call to the `VectorsReader` if the field exists in `FieldInfos` and has vectors 
enabled.)




-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

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