java.lang.Object
org.apache.lucene.codecs.KnnVectorsReader
org.elasticsearch.index.codec.vectors.diskbbq.IVFVectorsReader<E>
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
ES920DiskBBQVectorsReader, ES940DiskBBQVectorsReader, ESNextDiskBBQVectorsReader

public abstract class IVFVectorsReader<E extends IVFVectorsReader.FieldEntry> extends org.apache.lucene.codecs.KnnVectorsReader
Reader for IVF vectors. This reader is used to read the IVF vectors from the index.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static class 
     
    static interface 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.apache.lucene.internal.hppc.IntObjectHashMap<E>
     
    protected final org.apache.lucene.store.IndexInput
     
    protected final org.apache.lucene.store.IndexInput
     
    protected int
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    IVFVectorsReader(org.apache.lucene.index.SegmentReadState state, GenericFlatVectorReaders.LoadFlatVectorsReader loadReader, String codecName, String centroidExtension, String clusterExtension, String metaExtension, int versionStart, int versionCurrent, int versionDirectIo, float dynamicVisitRatio)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
     
    void
     
    protected abstract E
    doReadField(org.apache.lucene.store.IndexInput input, String rawVectorFormat, boolean useDirectIOReads, org.apache.lucene.index.VectorSimilarityFunction similarityFunction, org.apache.lucene.index.VectorEncoding vectorEncoding, int numCentroids, long centroidOffset, long centroidLength, long postingListOffset, long postingListLength, float[] globalCentroid, float globalCentroidDp)
     
    final org.apache.lucene.index.ByteVectorValues
     
    getCentroidIterator(org.apache.lucene.index.FieldInfo fieldInfo, int numCentroids, org.apache.lucene.store.IndexInput centroids, float[] target, org.apache.lucene.store.IndexInput postingListSlice, org.apache.lucene.search.AcceptDocs acceptDocs, float approximateCost, org.apache.lucene.index.FloatVectorValues values, float visitRatio)
     
    final org.apache.lucene.index.FloatVectorValues
     
    getOffHeapByteSize(org.apache.lucene.index.FieldInfo fieldInfo)
     
    getPostingVisitor(org.apache.lucene.index.FieldInfo fieldInfo, int numVectors, org.apache.lucene.store.IndexInput postingsLists, float[] target, org.apache.lucene.util.Bits needsScoring, org.apache.lucene.store.IndexInput centroidSlice)
     
    protected org.apache.lucene.codecs.hnsw.FlatVectorsReader
     
    protected static org.apache.lucene.store.IndexInput
    openDataInput(org.apache.lucene.index.SegmentReadState state, int versionMeta, String fileExtension, String codecName, int versionStart, int versionCurrent, org.apache.lucene.store.IOContext context)
     
    final void
    search(String field, byte[] target, org.apache.lucene.search.KnnCollector knnCollector, org.apache.lucene.search.AcceptDocs acceptDocs)
     
    final void
    search(String field, float[] target, org.apache.lucene.search.KnnCollector knnCollector, org.apache.lucene.search.AcceptDocs acceptDocs)
     

    Methods inherited from class org.apache.lucene.codecs.KnnVectorsReader

    finishMerge, getMergeInstance, mergeOffHeapByteSizeMaps

    Methods inherited from class java.lang.Object

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

    • ivfCentroids

      protected final org.apache.lucene.store.IndexInput ivfCentroids
    • ivfClusters

      protected final org.apache.lucene.store.IndexInput ivfClusters
    • fields

      protected final org.apache.lucene.internal.hppc.IntObjectHashMap<E extends IVFVectorsReader.FieldEntry> fields
    • versionMeta

      protected int versionMeta
  • Constructor Details

  • Method Details

    • getCentroidIterator

      public abstract CentroidIterator getCentroidIterator(org.apache.lucene.index.FieldInfo fieldInfo, int numCentroids, org.apache.lucene.store.IndexInput centroids, float[] target, org.apache.lucene.store.IndexInput postingListSlice, org.apache.lucene.search.AcceptDocs acceptDocs, float approximateCost, org.apache.lucene.index.FloatVectorValues values, float visitRatio) throws IOException
      Throws:
      IOException
    • openDataInput

      protected static org.apache.lucene.store.IndexInput openDataInput(org.apache.lucene.index.SegmentReadState state, int versionMeta, String fileExtension, String codecName, int versionStart, int versionCurrent, org.apache.lucene.store.IOContext context) throws IOException
      Throws:
      IOException
    • doReadField

      protected abstract E doReadField(org.apache.lucene.store.IndexInput input, String rawVectorFormat, boolean useDirectIOReads, org.apache.lucene.index.VectorSimilarityFunction similarityFunction, org.apache.lucene.index.VectorEncoding vectorEncoding, int numCentroids, long centroidOffset, long centroidLength, long postingListOffset, long postingListLength, float[] globalCentroid, float globalCentroidDp) throws IOException
      Throws:
      IOException
    • checkIntegrity

      public final void checkIntegrity() throws IOException
      Specified by:
      checkIntegrity in class org.apache.lucene.codecs.KnnVectorsReader
      Throws:
      IOException
    • getReaderForField

      protected org.apache.lucene.codecs.hnsw.FlatVectorsReader getReaderForField(String field)
    • getFloatVectorValues

      public final org.apache.lucene.index.FloatVectorValues getFloatVectorValues(String field) throws IOException
      Specified by:
      getFloatVectorValues in class org.apache.lucene.codecs.KnnVectorsReader
      Throws:
      IOException
    • getByteVectorValues

      public final org.apache.lucene.index.ByteVectorValues getByteVectorValues(String field) throws IOException
      Specified by:
      getByteVectorValues in class org.apache.lucene.codecs.KnnVectorsReader
      Throws:
      IOException
    • search

      public final void search(String field, float[] target, org.apache.lucene.search.KnnCollector knnCollector, org.apache.lucene.search.AcceptDocs acceptDocs) throws IOException
      Specified by:
      search in class org.apache.lucene.codecs.KnnVectorsReader
      Throws:
      IOException
    • search

      public final void search(String field, byte[] target, org.apache.lucene.search.KnnCollector knnCollector, org.apache.lucene.search.AcceptDocs acceptDocs) throws IOException
      Specified by:
      search in class org.apache.lucene.codecs.KnnVectorsReader
      Throws:
      IOException
    • getOffHeapByteSize

      public Map<String,Long> getOffHeapByteSize(org.apache.lucene.index.FieldInfo fieldInfo)
      Overrides:
      getOffHeapByteSize in class org.apache.lucene.codecs.KnnVectorsReader
    • close

      public void close() throws IOException
      Throws:
      IOException
    • getPostingVisitor

      public abstract IVFVectorsReader.PostingVisitor getPostingVisitor(org.apache.lucene.index.FieldInfo fieldInfo, int numVectors, org.apache.lucene.store.IndexInput postingsLists, float[] target, org.apache.lucene.util.Bits needsScoring, org.apache.lucene.store.IndexInput centroidSlice) throws IOException
      Throws:
      IOException