jpountz commented on code in PR #13763:
URL: https://github.com/apache/lucene/pull/13763#discussion_r1754532585
##########
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:
The javadocs are correct. AssertingKnnVectorsReader checks for this.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]