Module org.elasticsearch.server
Class FunctionScoreQuery
java.lang.Object
org.apache.lucene.search.Query
org.elasticsearch.common.lucene.search.function.FunctionScoreQuery
public class FunctionScoreQuery
extends org.apache.lucene.search.Query
A query that allows for a pluggable boost function / filter. If it matches
the filter, it will be boosted by the formula.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enum -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFunctionScoreQuery(org.apache.lucene.search.Query subQuery, Float minScore, float maxBoost) Creates a FunctionScoreQuery without function.FunctionScoreQuery(org.apache.lucene.search.Query subQuery, FunctionScoreQuery.ScoreMode scoreMode, ScoreFunction[] functions, CombineFunction combineFunction, Float minScore, float maxBoost) Creates a FunctionScoreQuery with multiple score functionsFunctionScoreQuery(org.apache.lucene.search.Query subQuery, ScoreFunction function) Creates a FunctionScoreQuery with a singleScoreFunctionFunctionScoreQuery(org.apache.lucene.search.Query subQuery, ScoreFunction function, CombineFunction combineFunction, Float minScore, float maxBoost) Creates a FunctionScoreQuery with a single function -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.lucene.search.WeightcreateWeight(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.ScoreMode scoreMode, float boost) booleanorg.apache.lucene.search.QueryinthashCode()org.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
-
Field Details
-
DEFAULT_MAX_BOOST
public static final float DEFAULT_MAX_BOOST- See Also:
-
-
Constructor Details
-
FunctionScoreQuery
Creates a FunctionScoreQuery without function.- Parameters:
subQuery- The query to match.minScore- The minimum score to consider a document.maxBoost- The maximum applicable boost.
-
FunctionScoreQuery
Creates a FunctionScoreQuery with a singleScoreFunction- Parameters:
subQuery- The query to match.function- TheScoreFunctionto apply.
-
FunctionScoreQuery
public FunctionScoreQuery(org.apache.lucene.search.Query subQuery, ScoreFunction function, CombineFunction combineFunction, Float minScore, float maxBoost) Creates a FunctionScoreQuery with a single function- Parameters:
subQuery- The query to match.function- TheScoreFunctionto apply.combineFunction- Defines how the query and function score should be applied.minScore- The minimum score to consider a document.maxBoost- The maximum applicable boost.
-
FunctionScoreQuery
public FunctionScoreQuery(org.apache.lucene.search.Query subQuery, FunctionScoreQuery.ScoreMode scoreMode, ScoreFunction[] functions, CombineFunction combineFunction, Float minScore, float maxBoost) Creates a FunctionScoreQuery with multiple score functions- Parameters:
subQuery- The query to match.scoreMode- Defines how the different score functions should be combined.functions- TheScoreFunctions to apply.combineFunction- Defines how the query and function score should be applied.minScore- The minimum score to consider a document.maxBoost- The maximum applicable boost.
-
-
Method Details
-
getSubQuery
public org.apache.lucene.search.Query getSubQuery() -
getFunctions
-
getMinScore
-
getCombineFunction
-
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 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
-
toString
- Specified by:
toStringin 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
-