mirror of https://github.com/apache/lucene.git
Lucene99HnswVectorsReader[.readFields] readability tweaks (#13532)
* remove unnecessary readFields parameter * consistently use this. in constructor * align declare and init order
This commit is contained in:
parent
8d1e624a67
commit
cc14555395
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue