Lucene99HnswVectorsReader[.readFields] readability tweaks (#13532)

* remove unnecessary readFields parameter
* consistently use this. in constructor
* align declare and init order
This commit is contained in:
Christine Poerschke 2024-07-12 09:49:32 +01:00 committed by GitHub
parent 8d1e624a67
commit cc14555395
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 5 deletions

View File

@ -68,10 +68,10 @@ public final class Lucene99HnswVectorsReader extends KnnVectorsReader
private static final long SHALLOW_SIZE =
RamUsageEstimator.shallowSizeOfInstance(Lucene99HnswVectorsFormat.class);
private final FlatVectorsReader flatVectorsReader;
private final FieldInfos fieldInfos;
private final Map<String, FieldEntry> fields = new HashMap<>();
private final IndexInput vectorIndex;
private final FlatVectorsReader flatVectorsReader;
public Lucene99HnswVectorsReader(SegmentReadState state, FlatVectorsReader flatVectorsReader)
throws IOException {
@ -93,13 +93,13 @@ public final class Lucene99HnswVectorsReader extends KnnVectorsReader
Lucene99HnswVectorsFormat.VERSION_CURRENT,
state.segmentInfo.getId(),
state.segmentSuffix);
readFields(meta, state.fieldInfos);
readFields(meta);
} catch (Throwable exception) {
priorE = exception;
} finally {
CodecUtil.checkFooter(meta, priorE);
}
vectorIndex =
this.vectorIndex =
openDataInput(
state,
versionMeta,
@ -154,9 +154,9 @@ public final class Lucene99HnswVectorsReader extends KnnVectorsReader
}
}
private void readFields(ChecksumIndexInput meta, FieldInfos infos) throws IOException {
private void readFields(ChecksumIndexInput meta) throws IOException {
for (int fieldNumber = meta.readInt(); fieldNumber != -1; fieldNumber = meta.readInt()) {
FieldInfo info = infos.fieldInfo(fieldNumber);
FieldInfo info = fieldInfos.fieldInfo(fieldNumber);
if (info == null) {
throw new CorruptIndexException("Invalid field number: " + fieldNumber, meta);
}