Class VectorValuesWriter

java.lang.Object
org.apache.lucene.index.VectorValuesWriter

class VectorValuesWriter extends Object
Buffers up pending vector value(s) per doc, then flushes when segment flushes.
  • Field Details

    • fieldInfo

      private final FieldInfo fieldInfo
    • iwBytesUsed

      private final Counter iwBytesUsed
    • vectors

      private final List<float[]> vectors
    • docsWithField

      private final DocsWithFieldSet docsWithField
    • lastDocID

      private int lastDocID
    • bytesUsed

      private long bytesUsed
  • Constructor Details

    • VectorValuesWriter

      VectorValuesWriter(FieldInfo fieldInfo, Counter iwBytesUsed)
  • Method Details

    • 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 document
      vectorValue - the value to add
      Throws:
      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 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 order
      knnVectorsWriter - the Codec's vector writer that handles the actual encoding and I/O
      Throws:
      IOException - if there is an error writing the field and its values