bugmakerrrrrr commented on code in PR #13763:
URL: https://github.com/apache/lucene/pull/13763#discussion_r1756317165


##########
lucene/core/src/java/org/apache/lucene/codecs/perfield/PerFieldKnnVectorsFormat.java:
##########
@@ -239,51 +245,69 @@ public FieldsReader(final SegmentReadState readState) 
throws IOException {
      * @param field the name of a numeric vector field
      */
     public KnnVectorsReader getFieldReader(String field) {
-      return fields.get(field);
+      final FieldInfo info = fieldInfos.fieldInfo(field);
+      if (info == null) {
+        return null;
+      }
+      return fields.get(info.number);
     }
 
     @Override
     public void checkIntegrity() throws IOException {
-      for (KnnVectorsReader reader : fields.values()) {
-        reader.checkIntegrity();
+      for (ObjectCursor<KnnVectorsReader> cursor : fields.values()) {
+        cursor.value.checkIntegrity();
       }
     }
 
     @Override
     public FloatVectorValues getFloatVectorValues(String field) throws 
IOException {
-      KnnVectorsReader knnVectorsReader = fields.get(field);
-      if (knnVectorsReader == null) {
+      final FieldInfo info = fieldInfos.fieldInfo(field);
+      KnnVectorsReader reader;
+      if (info == null || (reader = fields.get(info.number)) == null) {
         return null;

Review Comment:
   forgive me if i misunderstand something, but the javadoc says that **the 
return value is never null**, and we do return null in 
`PerFieldKnnVectorsFormat`. If we check the field info in caller, 
`AssertingKnnVectorsReader` will always get the non-null value from the 
delegate.



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