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 intbeamWidthprivate booleanfinishedprivate intMprivate intmaxDocprivate IndexOutputmetaprivate SegmentWriteStatesegmentWriteStateprivate IndexOutputvectorDataprivate IndexOutputvectorIndex
-
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 voidclose()voidfinish()Called once at the end before closevoidwriteField(FieldInfo fieldInfo, KnnVectorsReader knnVectorsReader)Write all values contained in the provided readerprivate OnHeapHnswGraphwriteGraph(RandomAccessVectorValuesProducer vectorValues, VectorSimilarityFunction similarityFunction)private voidwriteMeta(FieldInfo field, long vectorDataOffset, long vectorDataLength, long vectorIndexOffset, long vectorIndexLength, DocsWithFieldSet docsWithField, OnHeapHnswGraph graph)private static DocsWithFieldSetwriteVectorData(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:KnnVectorsWriterWrite all values contained in the provided reader- Specified by:
writeFieldin 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.IOExceptionDescription copied from class:KnnVectorsWriterCalled once at the end before close- Specified by:
finishin classKnnVectorsWriter- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Throws:
java.io.IOException
-
-