Skip to content

Commit

Permalink
Lucene99HnswVectorsReader[.readFields] readability tweaks (#13532)
Browse files Browse the repository at this point in the history
* remove unnecessary readFields parameter
* consistently use this. in constructor
* align declare and init order
  • Loading branch information
cpoerschke authored Jul 12, 2024
1 parent 8d1e624 commit cc14555
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -93,13 +93,13 @@ public Lucene99HnswVectorsReader(SegmentReadState state, FlatVectorsReader flatV
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,
Expand Down Expand Up @@ -154,9 +154,9 @@ private static IndexInput openDataInput(
}
}

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);
}
Expand Down

0 comments on commit cc14555

Please sign in to comment.