Module org.apache.lucene.core
Class Lucene99FlatVectorsReader
- java.lang.Object
-
- org.apache.lucene.codecs.hnsw.FlatVectorsReader
-
- org.apache.lucene.codecs.lucene99.Lucene99FlatVectorsReader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,Accountable
public final class Lucene99FlatVectorsReader extends FlatVectorsReader
Reads vectors from the index segments.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Lucene99FlatVectorsReader.FieldEntry
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,Lucene99FlatVectorsReader.FieldEntry>
fields
private static long
SHALLOW_SIZE
private IndexInput
vectorData
-
Fields inherited from class org.apache.lucene.codecs.hnsw.FlatVectorsReader
vectorScorer
-
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
-
Constructor Summary
Constructors Constructor Description Lucene99FlatVectorsReader(SegmentReadState state, FlatVectorsScorer scorer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkIntegrity()
Checks consistency of this reader.void
close()
ByteVectorValues
getByteVectorValues(java.lang.String field)
Returns theByteVectorValues
for the givenfield
.FloatVectorValues
getFloatVectorValues(java.lang.String field)
Returns theFloatVectorValues
for the givenfield
.RandomVectorScorer
getRandomVectorScorer(java.lang.String field, byte[] target)
Returns aRandomVectorScorer
for the given field and target vector.RandomVectorScorer
getRandomVectorScorer(java.lang.String field, float[] target)
Returns aRandomVectorScorer
for the given field and target vector.private static IndexInput
openDataInput(SegmentReadState state, int versionMeta, java.lang.String fileExtension, java.lang.String codecName, IOContext context)
long
ramBytesUsed()
Return the memory usage of this object in bytes.private Lucene99FlatVectorsReader.FieldEntry
readField(IndexInput input, FieldInfo info)
private void
readFields(ChecksumIndexInput meta, FieldInfos infos)
private int
readMetadata(SegmentReadState state)
private void
validateFieldEntry(FieldInfo info, Lucene99FlatVectorsReader.FieldEntry fieldEntry)
-
Methods inherited from class org.apache.lucene.codecs.hnsw.FlatVectorsReader
getFlatVectorScorer
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
-
-
-
Field Detail
-
SHALLOW_SIZE
private static final long SHALLOW_SIZE
-
fields
private final java.util.Map<java.lang.String,Lucene99FlatVectorsReader.FieldEntry> fields
-
vectorData
private final IndexInput vectorData
-
-
Constructor Detail
-
Lucene99FlatVectorsReader
public Lucene99FlatVectorsReader(SegmentReadState state, FlatVectorsScorer scorer) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
readMetadata
private int readMetadata(SegmentReadState state) throws java.io.IOException
- Throws:
java.io.IOException
-
openDataInput
private static IndexInput openDataInput(SegmentReadState state, int versionMeta, java.lang.String fileExtension, java.lang.String codecName, IOContext context) throws java.io.IOException
- Throws:
java.io.IOException
-
readFields
private void readFields(ChecksumIndexInput meta, FieldInfos infos) throws java.io.IOException
- Throws:
java.io.IOException
-
validateFieldEntry
private void validateFieldEntry(FieldInfo info, Lucene99FlatVectorsReader.FieldEntry fieldEntry)
-
readField
private Lucene99FlatVectorsReader.FieldEntry readField(IndexInput input, FieldInfo info) throws java.io.IOException
- Throws:
java.io.IOException
-
ramBytesUsed
public long ramBytesUsed()
Description copied from interface:Accountable
Return the memory usage of this object in bytes. Negative values are illegal.
-
checkIntegrity
public void checkIntegrity() throws java.io.IOException
Description copied from class:FlatVectorsReader
Checks consistency of this reader.Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value against large data files.
- Specified by:
checkIntegrity
in classFlatVectorsReader
- Throws:
java.io.IOException
-
getFloatVectorValues
public FloatVectorValues getFloatVectorValues(java.lang.String field) throws java.io.IOException
Description copied from class:FlatVectorsReader
Returns theFloatVectorValues
for the givenfield
. The behavior is undefined if the given field doesn't have KNN vectors enabled on itsFieldInfo
. The return value is nevernull
.- Specified by:
getFloatVectorValues
in classFlatVectorsReader
- Throws:
java.io.IOException
-
getByteVectorValues
public ByteVectorValues getByteVectorValues(java.lang.String field) throws java.io.IOException
Description copied from class:FlatVectorsReader
Returns theByteVectorValues
for the givenfield
. The behavior is undefined if the given field doesn't have KNN vectors enabled on itsFieldInfo
. The return value is nevernull
.- Specified by:
getByteVectorValues
in classFlatVectorsReader
- Throws:
java.io.IOException
-
getRandomVectorScorer
public RandomVectorScorer getRandomVectorScorer(java.lang.String field, float[] target) throws java.io.IOException
Description copied from class:FlatVectorsReader
Returns aRandomVectorScorer
for the given field and target vector.- Specified by:
getRandomVectorScorer
in classFlatVectorsReader
- Parameters:
field
- the field to searchtarget
- the target vector- Returns:
- a
RandomVectorScorer
for the given field and target vector. - Throws:
java.io.IOException
- if an I/O error occurs when reading from the index.
-
getRandomVectorScorer
public RandomVectorScorer getRandomVectorScorer(java.lang.String field, byte[] target) throws java.io.IOException
Description copied from class:FlatVectorsReader
Returns aRandomVectorScorer
for the given field and target vector.- Specified by:
getRandomVectorScorer
in classFlatVectorsReader
- Parameters:
field
- the field to searchtarget
- the target vector- Returns:
- a
RandomVectorScorer
for the given field and target vector. - Throws:
java.io.IOException
- if an I/O error occurs when reading from the index.
-
close
public void close() throws java.io.IOException
- Throws:
java.io.IOException
-
-