Module org.elasticsearch.server
Package org.elasticsearch.search.vectors
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
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected final org.apache.lucene.search.Queryprotected final intprotected final intprotected final intprotected final org.apache.lucene.search.knn.KnnSearchStrategyprotected int -
Constructor Summary
ConstructorsConstructorDescriptionIVFKnnFloatVectorQuery(String field, float[] query, int k, int numCands, org.apache.lucene.search.Query filter, int nProbe) Creates a newIVFKnnFloatVectorQuerywith the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.lucene.search.TopDocsapproximateSearch(org.apache.lucene.index.LeafReaderContext context, org.apache.lucene.util.Bits acceptDocs, int visitedLimit, org.apache.lucene.search.knn.KnnCollectorManager knnCollectorManager) booleanprotected org.apache.lucene.search.knn.KnnCollectorManagergetKnnCollectorManager(int k, org.apache.lucene.search.IndexSearcher searcher) inthashCode()final voidprofile(QueryProfiler queryProfiler) Store the profiling information in theQueryProfilerorg.apache.lucene.search.Queryrewrite(org.apache.lucene.search.IndexSearcher indexSearcher) voidvisit(org.apache.lucene.search.QueryVisitor visitor) Methods inherited from class org.apache.lucene.search.Query
classHash, createWeight, sameClassAs, toString
-
Field Details
-
field
-
nProbe
protected final int nProbe -
k
protected final int k -
numCands
protected final int numCands -
filter
protected final org.apache.lucene.search.Query filter -
searchStrategy
protected final org.apache.lucene.search.knn.KnnSearchStrategy searchStrategy -
vectorOpsCount
protected int vectorOpsCount
-
-
Constructor Details
-
IVFKnnFloatVectorQuery
public IVFKnnFloatVectorQuery(String field, float[] query, int k, int numCands, org.apache.lucene.search.Query filter, int nProbe) Creates a newIVFKnnFloatVectorQuerywith the given parameters.- Parameters:
field- the field to searchquery- the query vectork- the number of nearest neighbors to returnnumCands- the number of nearest neighbors to gather per shardfilter- the filter to apply to the resultsnProbe- the number of probes to use for the IVF search strategy
-
-
Method Details
-
toString
- Specified by:
toStringin classorg.apache.lucene.search.Query
-
equals
-
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) throws IOException - Throws:
IOException
-
visit
public void visit(org.apache.lucene.search.QueryVisitor visitor) - Specified by:
visitin classorg.apache.lucene.search.Query
-
rewrite
public org.apache.lucene.search.Query rewrite(org.apache.lucene.search.IndexSearcher indexSearcher) throws IOException - Overrides:
rewritein classorg.apache.lucene.search.Query- Throws:
IOException
-
getKnnCollectorManager
protected org.apache.lucene.search.knn.KnnCollectorManager getKnnCollectorManager(int k, org.apache.lucene.search.IndexSearcher searcher) -
profile
Description copied from interface:QueryProfilerProviderStore the profiling information in theQueryProfiler- Specified by:
profilein interfaceQueryProfilerProvider- Parameters:
queryProfiler- an instance ofKnnFloatVectorField.
-