Package org.apache.lucene.codecs.hnsw
Class FlatFieldVectorsWriter<T>
java.lang.Object
org.apache.lucene.codecs.KnnFieldVectorsWriter<T>
org.apache.lucene.codecs.hnsw.FlatFieldVectorsWriter<T>
- Type Parameters:
T- an array type; the type of vectors to be written
- All Implemented Interfaces:
Accountable
Vectors' writer for a field
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Field Summary
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasKnnVectorValues(VectorEncoding encoding, int dim) Returns aKnnVectorValuesview over the vectors to be written.abstract voidfinish()indicates that this writer is done and no new vectors are allowed to be addedabstract DocsWithFieldSetabstract booleanMethods inherited from class org.apache.lucene.codecs.KnnFieldVectorsWriter
addValue, copyValueMethods 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, ramBytesUsed
-
Constructor Details
-
FlatFieldVectorsWriter
public FlatFieldVectorsWriter()
-
-
Method Details
-
getVectors
- Returns:
- a list of vectors to be written
-
asKnnVectorValues
Returns aKnnVectorValuesview over the vectors to be written.This default implementation uses
getVectors()and wraps them viaFloatVectorValues.fromFloats(java.util.List<float[]>, int)/ByteVectorValues.fromBytes(java.util.List<byte[]>, int). Subclasses backed by alternative storage may override to return a richer view (e.g. one that exposes capability information to scorers, or avoids heap materialization).- Parameters:
encoding- the vector encoding/element typedim- the field's declared vector dimension- Throws:
IOException
-
getDocsWithFieldSet
- Returns:
- the docsWithFieldSet for the field writer
-
finish
indicates that this writer is done and no new vectors are allowed to be added- Throws:
IOException- if an I/O error occurs
-
isFinished
public abstract boolean isFinished()- Returns:
- true if the writer is done and no new vectors are allowed to be added
-