Class IVFKnnFloatVectorQuery

java.lang.Object
org.apache.lucene.search.Query
org.elasticsearch.search.vectors.IVFKnnFloatVectorQuery
All Implemented Interfaces:
QueryProfilerProvider
Direct Known Subclasses:
DiversifyingChildrenIVFKnnFloatVectorQuery

public class IVFKnnFloatVectorQuery extends org.apache.lucene.search.Query
A IVFKnnFloatVectorQuery that uses the IVF search strategy.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final String
     
    protected final org.apache.lucene.search.Query
     
    protected final int
     
    protected final int
     
    protected final float
     
    protected int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    IVFKnnFloatVectorQuery(String field, float[] query, int k, int numCands, org.apache.lucene.search.Query filter, float visitRatio)
    Creates a new IVFKnnFloatVectorQuery with the given parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.apache.lucene.search.TopDocs
    approximateSearch(org.apache.lucene.index.LeafReaderContext context, org.apache.lucene.util.Bits acceptDocs, int visitedLimit, org.apache.lucene.search.knn.KnnCollectorManager knnCollectorManager, float visitRatio)
     
    boolean
     
    protected org.apache.lucene.search.knn.KnnCollectorManager
    getKnnCollectorManager(int k, org.apache.lucene.search.IndexSearcher searcher)
     
    int
     
    final void
    profile(QueryProfiler queryProfiler)
    Store the profiling information in the QueryProfiler
    org.apache.lucene.search.Query
    rewrite(org.apache.lucene.search.IndexSearcher indexSearcher)
     
     
    void
    visit(org.apache.lucene.search.QueryVisitor visitor)
     

    Methods inherited from class org.apache.lucene.search.Query

    classHash, createWeight, sameClassAs, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • field

      protected final String field
    • providedVisitRatio

      protected final float providedVisitRatio
    • k

      protected final int k
    • numCands

      protected final int numCands
    • filter

      protected final org.apache.lucene.search.Query filter
    • vectorOpsCount

      protected int vectorOpsCount
  • Constructor Details

    • IVFKnnFloatVectorQuery

      public IVFKnnFloatVectorQuery(String field, float[] query, int k, int numCands, org.apache.lucene.search.Query filter, float visitRatio)
      Creates a new IVFKnnFloatVectorQuery with the given parameters.
      Parameters:
      field - the field to search
      query - the query vector
      k - the number of nearest neighbors to return
      numCands - the number of nearest neighbors to gather per shard
      filter - the filter to apply to the results
      visitRatio - the ratio of vectors to score for the IVF search strategy
  • Method Details

    • toString

      public String toString(String field)
      Specified by:
      toString in class org.apache.lucene.search.Query
    • equals

      public boolean equals(Object o)
    • hashCode

      public int hashCode()
    • approximateSearch

      protected org.apache.lucene.search.TopDocs approximateSearch(org.apache.lucene.index.LeafReaderContext context, org.apache.lucene.util.Bits acceptDocs, int visitedLimit, org.apache.lucene.search.knn.KnnCollectorManager knnCollectorManager, float visitRatio) throws IOException
      Throws:
      IOException
    • visit

      public void visit(org.apache.lucene.search.QueryVisitor visitor)
      Specified by:
      visit in class org.apache.lucene.search.Query
    • rewrite

      public org.apache.lucene.search.Query rewrite(org.apache.lucene.search.IndexSearcher indexSearcher) throws IOException
      Overrides:
      rewrite in class org.apache.lucene.search.Query
      Throws:
      IOException
    • getKnnCollectorManager

      protected org.apache.lucene.search.knn.KnnCollectorManager getKnnCollectorManager(int k, org.apache.lucene.search.IndexSearcher searcher)
    • profile

      public final void profile(QueryProfiler queryProfiler)
      Description copied from interface: QueryProfilerProvider
      Store the profiling information in the QueryProfiler
      Specified by:
      profile in interface QueryProfilerProvider
      Parameters:
      queryProfiler - an instance of KnnFloatVectorField.