Class Lucene92HnswVectorsWriter
- java.lang.Object
-
- org.apache.lucene.codecs.KnnVectorsWriter
-
- org.apache.lucene.codecs.lucene92.Lucene92HnswVectorsWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public final class Lucene92HnswVectorsWriter extends KnnVectorsWriter
Writes vector values and knn graphs to index segments.
-
-
Field Summary
Fields Modifier and Type Field Description private int
beamWidth
private boolean
finished
private int
M
private int
maxDoc
private IndexOutput
meta
private SegmentWriteState
segmentWriteState
private IndexOutput
vectorData
private IndexOutput
vectorIndex
-
Constructor Summary
Constructors Constructor Description Lucene92HnswVectorsWriter(SegmentWriteState state, int M, int beamWidth)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
finish()
Called once at the end before closevoid
writeField(FieldInfo fieldInfo, KnnVectorsReader knnVectorsReader)
Write all values contained in the provided readerprivate OnHeapHnswGraph
writeGraph(RandomAccessVectorValuesProducer vectorValues, VectorSimilarityFunction similarityFunction)
private void
writeMeta(FieldInfo field, long vectorDataOffset, long vectorDataLength, long vectorIndexOffset, long vectorIndexLength, DocsWithFieldSet docsWithField, OnHeapHnswGraph graph)
private static DocsWithFieldSet
writeVectorData(IndexOutput output, VectorValues vectors)
Writes the vector values to the output and returns a set of documents that contains vectors.-
Methods inherited from class org.apache.lucene.codecs.KnnVectorsWriter
merge
-
-
-
-
Field Detail
-
segmentWriteState
private final SegmentWriteState segmentWriteState
-
meta
private final IndexOutput meta
-
vectorData
private final IndexOutput vectorData
-
vectorIndex
private final IndexOutput vectorIndex
-
maxDoc
private final int maxDoc
-
M
private final int M
-
beamWidth
private final int beamWidth
-
finished
private boolean finished
-
-
Constructor Detail
-
Lucene92HnswVectorsWriter
Lucene92HnswVectorsWriter(SegmentWriteState state, int M, int beamWidth) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
writeField
public void writeField(FieldInfo fieldInfo, KnnVectorsReader knnVectorsReader) throws java.io.IOException
Description copied from class:KnnVectorsWriter
Write all values contained in the provided reader- Specified by:
writeField
in classKnnVectorsWriter
- Throws:
java.io.IOException
-
writeVectorData
private static DocsWithFieldSet writeVectorData(IndexOutput output, VectorValues vectors) throws java.io.IOException
Writes the vector values to the output and returns a set of documents that contains vectors.- Throws:
java.io.IOException
-
writeMeta
private void writeMeta(FieldInfo field, long vectorDataOffset, long vectorDataLength, long vectorIndexOffset, long vectorIndexLength, DocsWithFieldSet docsWithField, OnHeapHnswGraph graph) throws java.io.IOException
- Throws:
java.io.IOException
-
writeGraph
private OnHeapHnswGraph writeGraph(RandomAccessVectorValuesProducer vectorValues, VectorSimilarityFunction similarityFunction) throws java.io.IOException
- Throws:
java.io.IOException
-
finish
public void finish() throws java.io.IOException
Description copied from class:KnnVectorsWriter
Called once at the end before close- Specified by:
finish
in classKnnVectorsWriter
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Throws:
java.io.IOException
-
-