Package org.apache.lucene.codecs.hnsw
Class FlatVectorsWriter
java.lang.Object
org.apache.lucene.codecs.KnnVectorsWriter
org.apache.lucene.codecs.hnsw.FlatVectorsWriter
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Accountable
- Direct Known Subclasses:
Lucene102BinaryQuantizedVectorsWriter
,Lucene99FlatVectorsWriter
,Lucene99ScalarQuantizedVectorsWriter
Vectors' writer for a field that allows additional indexing logic to be implemented by the caller
- 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
FieldsFields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
FlatVectorsWriter
(FlatVectorsScorer vectorsScorer) Sole constructor -
Method Summary
Modifier and TypeMethodDescriptionabstract FlatFieldVectorsWriter
<?> Add a new field for indexingabstract CloseableRandomVectorScorerSupplier
mergeOneFieldToIndex
(FieldInfo fieldInfo, MergeState mergeState) Write the field for merging, providing a scorer over the newly merged flat vectors.Methods inherited from class org.apache.lucene.codecs.KnnVectorsWriter
finish, flush, mapOldOrdToNewOrd, merge, mergeOneField
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, ramBytesUsed
-
Field Details
-
vectorsScorer
Scorer for flat vectors
-
-
Constructor Details
-
FlatVectorsWriter
Sole constructor
-
-
Method Details
-
getFlatVectorScorer
- Returns:
- the
FlatVectorsScorer
for this reader.
-
addField
Add a new field for indexing- Specified by:
addField
in classKnnVectorsWriter
- 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
-
mergeOneFieldToIndex
public abstract CloseableRandomVectorScorerSupplier mergeOneFieldToIndex(FieldInfo fieldInfo, MergeState mergeState) throws IOException Write the field for merging, providing a scorer over the newly merged flat vectors. This way any additional merging logic can be implemented by the user of this class.- Parameters:
fieldInfo
- fieldInfo of the field to mergemergeState
- mergeState of the segments to merge- Returns:
- a scorer over the newly merged flat vectors, which should be closed as it holds a temporary file handle to read over the newly merged vectors
- Throws:
IOException
- if an I/O error occurs when merging
-