Package org.apache.lucene.index
Class VectorValuesWriter
- java.lang.Object
-
- org.apache.lucene.index.VectorValuesWriter
-
class VectorValuesWriter extends java.lang.ObjectBuffers up pending vector value(s) per doc, then flushes when segment flushes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classVectorValuesWriter.BufferedVectorValues(package private) static classVectorValuesWriter.SortingVectorValues
-
Field Summary
Fields Modifier and Type Field Description private longbytesUsedprivate DocsWithFieldSetdocsWithFieldprivate FieldInfofieldInfoprivate CounteriwBytesUsedprivate intlastDocIDprivate java.util.List<float[]>vectors
-
Constructor Summary
Constructors Constructor Description VectorValuesWriter(FieldInfo fieldInfo, Counter iwBytesUsed)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddValue(int docID, float[] vectorValue)Adds a value for the given document.voidflush(Sorter.DocMap sortMap, KnnVectorsWriter knnVectorsWriter)Flush this field's values to storage, sorting the values in accordance with sortMapprivate voidupdateBytesUsed()
-
-
-
Field Detail
-
fieldInfo
private final FieldInfo fieldInfo
-
iwBytesUsed
private final Counter iwBytesUsed
-
vectors
private final java.util.List<float[]> vectors
-
docsWithField
private final DocsWithFieldSet docsWithField
-
lastDocID
private int lastDocID
-
bytesUsed
private long bytesUsed
-
-
Method Detail
-
addValue
public void addValue(int docID, float[] vectorValue)Adds a value for the given document. Only a single value may be added.- Parameters:
docID- the value is added to this documentvectorValue- the value to add- Throws:
java.lang.IllegalArgumentException- if a value has already been added to the given document
-
updateBytesUsed
private void updateBytesUsed()
-
flush
public void flush(Sorter.DocMap sortMap, KnnVectorsWriter knnVectorsWriter) throws java.io.IOException
Flush this field's values to storage, sorting the values in accordance with sortMap- Parameters:
sortMap- specifies the order of documents being flushed, or null if they are to be flushed in docid orderknnVectorsWriter- the Codec's vector writer that handles the actual encoding and I/O- Throws:
java.io.IOException- if there is an error writing the field and its values
-
-