Class Lucene99FlatVectorsWriter
java.lang.Object
org.apache.lucene.codecs.KnnVectorsWriter
org.apache.lucene.codecs.hnsw.FlatVectorsWriter
org.apache.lucene.codecs.lucene99.Lucene99FlatVectorsWriter
- All Implemented Interfaces:
Closeable,AutoCloseable,Accountable
Writes vector values to index segments.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.codecs.KnnVectorsWriter
KnnVectorsWriter.MergedVectorValues -
Field Summary
Fields inherited from class org.apache.lucene.codecs.hnsw.FlatVectorsWriter
vectorsScorerFields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
ConstructorsConstructorDescriptionLucene99FlatVectorsWriter(SegmentWriteState state, FlatVectorsScorer scorer) Constructs a writer that uses the default factory to build per-field vector storage.Lucene99FlatVectorsWriter(SegmentWriteState state, FlatVectorsScorer scorer, IOFunction<FieldInfo, FlatFieldVectorsWriter<?>> strategyFactory) Constructs a writer that uses the suppliedstrategyFactoryto build per-field vector storage. -
Method Summary
Modifier and TypeMethodDescriptionAdd a new field for indexingvoidclose()voidfinish()Called once at the end before closevoidflush(int maxDoc, Sorter.DocMap sortMap) Flush all buffered data on disk *voidmergeOneFlatVectorField(FieldInfo fieldInfo, MergeState mergeState) longReturns an estimate of the JVM heap memory used by this object in bytes.Methods inherited from class org.apache.lucene.codecs.hnsw.FlatVectorsWriter
getFlatVectorScorer, mergeOneFieldMethods inherited from class org.apache.lucene.codecs.KnnVectorsWriter
mapOldOrdToNewOrd, mergeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
Constructor Details
-
Lucene99FlatVectorsWriter
public Lucene99FlatVectorsWriter(SegmentWriteState state, FlatVectorsScorer scorer) throws IOException Constructs a writer that uses the default factory to build per-field vector storage. This default factory creates instances ofFlatFieldVectorsWriterthat store vector data as a List of on-heap arrays, one per-vector (seeDefaultFieldWriter).- Parameters:
state- the segment write statescorer- the flat vectors scorer used to score vectors at index-build time- Throws:
IOException
-
Lucene99FlatVectorsWriter
public Lucene99FlatVectorsWriter(SegmentWriteState state, FlatVectorsScorer scorer, IOFunction<FieldInfo, FlatFieldVectorsWriter<?>> strategyFactory) throws IOExceptionConstructs a writer that uses the suppliedstrategyFactoryto build per-field vector storage. The factory is consulted on everyaddField(FieldInfo)call and returns a user-definedFlatFieldVectorsWriter.Note: the strategy is only consulted during indexing (i.e. via
addField(FieldInfo)and the subsequentflush(int, org.apache.lucene.index.Sorter.DocMap)). Merges write directly to the new segment viamergeOneFlatVectorField(org.apache.lucene.index.FieldInfo, org.apache.lucene.index.MergeState)and do not go through the strategy.- Parameters:
state- the segment write statescorer- the flat vectors scorer used to score vectors at index-build timestrategyFactory- the per-field storage factory; receives theFieldInfofor the field being added and returns theFlatFieldVectorsWriterthat will back it- Throws:
IOException
-
-
Method Details
-
addField
Description copied from class:FlatVectorsWriterAdd a new field for indexing- Specified by:
addFieldin classFlatVectorsWriter- Parameters:
fieldInfo- fieldInfo of the field to add- Returns:
- a writer for the field
- Throws:
IOException- if an I/O error occurs when adding the field
-
flush
Description copied from class:KnnVectorsWriterFlush all buffered data on disk *- Specified by:
flushin classKnnVectorsWriter- Throws:
IOException
-
finish
Description copied from class:KnnVectorsWriterCalled once at the end before close- Specified by:
finishin classKnnVectorsWriter- Throws:
IOException
-
ramBytesUsed
public long ramBytesUsed()Description copied from interface:AccountableReturns an estimate of the JVM heap memory used by this object in bytes. The method name uses "ram" for historical reasons; only JVM heap memory should be reported. Off-heap resources such as memory-mapped files or native direct buffers should not be included. Negative values are illegal. -
mergeOneFlatVectorField
- Specified by:
mergeOneFlatVectorFieldin classFlatVectorsWriter- Throws:
IOException
-
close
- Throws:
IOException
-