Class KmeansFloatVectorValues

java.lang.Object
org.apache.lucene.index.KnnVectorValues
org.apache.lucene.index.FloatVectorValues
org.elasticsearch.index.codec.vectors.cluster.KmeansFloatVectorValues

public final class KmeansFloatVectorValues extends org.apache.lucene.index.FloatVectorValues
Unified class that can represent on-heap and off-heap vector values.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.lucene.index.KnnVectorValues

    org.apache.lucene.index.KnnVectorValues.DocIndexIterator
  • Method Summary

    Modifier and Type
    Method
    Description
    build(List<float[]> vectors, int[] docs, int dim)
    Build an instance from on-heap data structures.
    build(org.apache.lucene.store.IndexInput vectors, org.apache.lucene.store.IndexInput docs, int numVectors, int dims)
    Builds an instance from off-heap data structures.
    org.apache.lucene.index.FloatVectorValues
     
    int
     
    int
    ordToDoc(int ord)
     
    int
     
    float[]
    vectorValue(int ord)
     

    Methods inherited from class org.apache.lucene.index.FloatVectorValues

    checkField, fromFloats, getEncoding, scorer

    Methods inherited from class org.apache.lucene.index.KnnVectorValues

    createDenseIterator, createSparseIterator, fromDISI, getAcceptOrds, getVectorByteLength, iterator

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • build

      public static KmeansFloatVectorValues build(List<float[]> vectors, int[] docs, int dim)
      Build an instance from on-heap data structures.
    • build

      public static KmeansFloatVectorValues build(org.apache.lucene.store.IndexInput vectors, org.apache.lucene.store.IndexInput docs, int numVectors, int dims) throws IOException
      Builds an instance from off-heap data structures. Vectors are expected to be written as little endian floats one after the other. Docs are expected to be written as little endian ints one after the other.
      Throws:
      IOException
    • vectorValue

      public float[] vectorValue(int ord) throws IOException
      Specified by:
      vectorValue in class org.apache.lucene.index.FloatVectorValues
      Throws:
      IOException
    • copy

      public org.apache.lucene.index.FloatVectorValues copy()
      Specified by:
      copy in class org.apache.lucene.index.FloatVectorValues
    • dimension

      public int dimension()
      Specified by:
      dimension in class org.apache.lucene.index.KnnVectorValues
    • size

      public int size()
      Specified by:
      size in class org.apache.lucene.index.KnnVectorValues
    • ordToDoc

      public int ordToDoc(int ord)
      Overrides:
      ordToDoc in class org.apache.lucene.index.KnnVectorValues