mirror of
https://github.com/apache/lucene.git
synced 2025-02-09 11:35:14 +00:00
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 =
|
private static final long SHALLOW_SIZE =
|
||||||
RamUsageEstimator.shallowSizeOfInstance(Lucene99HnswVectorsFormat.class);
|
RamUsageEstimator.shallowSizeOfInstance(Lucene99HnswVectorsFormat.class);
|
||||||
|
|
||||||
|
private final FlatVectorsReader flatVectorsReader;
|
||||||
private final FieldInfos fieldInfos;
|
private final FieldInfos fieldInfos;
|
||||||
private final Map<String, FieldEntry> fields = new HashMap<>();
|
private final Map<String, FieldEntry> fields = new HashMap<>();
|
||||||
private final IndexInput vectorIndex;
|
private final IndexInput vectorIndex;
|
||||||
private final FlatVectorsReader flatVectorsReader;
|
|
||||||
|
|
||||||
public Lucene99HnswVectorsReader(SegmentReadState state, FlatVectorsReader flatVectorsReader)
|
public Lucene99HnswVectorsReader(SegmentReadState state, FlatVectorsReader flatVectorsReader)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
@ -93,13 +93,13 @@ public final class Lucene99HnswVectorsReader extends KnnVectorsReader
|
|||||||
Lucene99HnswVectorsFormat.VERSION_CURRENT,
|
Lucene99HnswVectorsFormat.VERSION_CURRENT,
|
||||||
state.segmentInfo.getId(),
|
state.segmentInfo.getId(),
|
||||||
state.segmentSuffix);
|
state.segmentSuffix);
|
||||||
readFields(meta, state.fieldInfos);
|
readFields(meta);
|
||||||
} catch (Throwable exception) {
|
} catch (Throwable exception) {
|
||||||
priorE = exception;
|
priorE = exception;
|
||||||
} finally {
|
} finally {
|
||||||
CodecUtil.checkFooter(meta, priorE);
|
CodecUtil.checkFooter(meta, priorE);
|
||||||
}
|
}
|
||||||
vectorIndex =
|
this.vectorIndex =
|
||||||
openDataInput(
|
openDataInput(
|
||||||
state,
|
state,
|
||||||
versionMeta,
|
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()) {
|
for (int fieldNumber = meta.readInt(); fieldNumber != -1; fieldNumber = meta.readInt()) {
|
||||||
FieldInfo info = infos.fieldInfo(fieldNumber);
|
FieldInfo info = fieldInfos.fieldInfo(fieldNumber);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
throw new CorruptIndexException("Invalid field number: " + fieldNumber, meta);
|
throw new CorruptIndexException("Invalid field number: " + fieldNumber, meta);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user