Module org.elasticsearch.server
Package org.elasticsearch.search.vectors
Class VectorSimilarityQuery
java.lang.Object
org.apache.lucene.search.Query
org.elasticsearch.search.vectors.VectorSimilarityQuery
- All Implemented Interfaces:
QueryProfilerProvider
public class VectorSimilarityQuery
extends org.apache.lucene.search.Query
implements QueryProfilerProvider
This query provides a simple post-filter for the provided Query to limit the results of the inner query to those that have a similarity
above a certain threshold
-
Constructor Summary
ConstructorsConstructorDescriptionVectorSimilarityQuery(org.apache.lucene.search.Query innerKnnQuery, float similarity, float docScore) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.lucene.search.WeightcreateWeight(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.ScoreMode scoreMode, float boost) booleaninthashCode()voidprofile(QueryProfiler queryProfiler) Store the profiling information in theQueryProfilerorg.apache.lucene.search.Queryrewrite(org.apache.lucene.search.IndexSearcher searcher) voidvisit(org.apache.lucene.search.QueryVisitor visitor) Methods inherited from class org.apache.lucene.search.Query
classHash, sameClassAs, toString
-
Constructor Details
-
VectorSimilarityQuery
public VectorSimilarityQuery(org.apache.lucene.search.Query innerKnnQuery, float similarity, float docScore) - Parameters:
innerKnnQuery- AKnnFloatVectorQueryorKnnByteVectorQuerysimilarity- The similarity threshold originally provided (used in explanations)docScore- The similarity transformed into a score threshold applied after gathering the nearest neighbors
-
-
Method Details
-
rewrite
public org.apache.lucene.search.Query rewrite(org.apache.lucene.search.IndexSearcher searcher) throws IOException - Overrides:
rewritein classorg.apache.lucene.search.Query- Throws:
IOException
-
createWeight
public org.apache.lucene.search.Weight createWeight(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.ScoreMode scoreMode, float boost) throws IOException - Overrides:
createWeightin classorg.apache.lucene.search.Query- Throws:
IOException
-
profile
Description copied from interface:QueryProfilerProviderStore the profiling information in theQueryProfiler- Specified by:
profilein interfaceQueryProfilerProvider- Parameters:
queryProfiler- an instance ofKnnFloatVectorField.
-
toString
- Specified by:
toStringin classorg.apache.lucene.search.Query
-
visit
public void visit(org.apache.lucene.search.QueryVisitor visitor) - Specified by:
visitin classorg.apache.lucene.search.Query
-
equals
- Specified by:
equalsin classorg.apache.lucene.search.Query
-
hashCode
public int hashCode()- Specified by:
hashCodein classorg.apache.lucene.search.Query
-