@ExperimentalApi @SearchPrimitive public class FunctionScoreQuery extends Object implements SearchQuery
FunctionScoreQuery.BoostMode
with an value provided by ScoreFunction
.
E.g. Assuming a document has a field page-rank
storing a float value and we want to adjust a document
score such that a new score will be original text score _score * ln(1 + page-rank)
, the the query would
be
<@code SearchQuery q = new FunctionScoreQuery(new SiteTextSearchQuery("perplexity"), new FieldValueFactorFunction(new FloatFieldValueSource("page-rank"), 1.0, Modifier.LOG1P), FunctionScoreQuery.BoostMode.SUM); >
Modifier and Type | Class and Description |
---|---|
static class |
FunctionScoreQuery.BoostMode |
Constructor and Description |
---|
FunctionScoreQuery(SearchQuery wrappedQuery,
ScoreFunction function,
FunctionScoreQuery.BoostMode boostMode) |
Modifier and Type | Method and Description |
---|---|
SearchQuery |
expand()
This primitive but is similar to
BooleanQuery , which in some sense primitive but also need to implement
expand method, because the wrapped query need to be expanded. |
FunctionScoreQuery.BoostMode |
getBoostMode() |
ScoreFunction |
getFunction() |
String |
getKey() |
List |
getParameters()
List of parameters as
String s or SearchQuery s. |
SearchQuery |
getWrappedQuery() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBoost
public static final String KEY
public FunctionScoreQuery(SearchQuery wrappedQuery, ScoreFunction function, FunctionScoreQuery.BoostMode boostMode)
public String getKey()
getKey
in interface SearchQuery
public List getParameters()
SearchQuery
String
s or SearchQuery
s.getParameters
in interface SearchQuery
String
s or SearchQuery
s.public FunctionScoreQuery.BoostMode getBoostMode()
public ScoreFunction getFunction()
public SearchQuery getWrappedQuery()
public SearchQuery expand()
BooleanQuery
, which in some sense primitive but also need to implement
expand method, because the wrapped query need to be expanded.expand
in interface Expandable<SearchQuery>
expand
in interface SearchQuery
Copyright © 2003–2023 Atlassian. All rights reserved.