Class VectorValuesWriter


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

      • fieldInfo

        private final FieldInfo fieldInfo
      • iwBytesUsed

        private final Counter iwBytesUsed
      • vectors

        private final java.util.List<float[]> vectors
      • lastDocID

        private int lastDocID
      • bytesUsed

        private long bytesUsed
    • Constructor Detail

      • VectorValuesWriter

        VectorValuesWriter​(FieldInfo fieldInfo,
                           Counter iwBytesUsed)
    • 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 document
        vectorValue - 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 order
        knnVectorsWriter - 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