@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 |
|---|---|
boolean |
equals(Object o) |
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
Strings or SearchQuerys. |
Stream<SubClause<SearchQuery>> |
getSubClauses()
Returns a stream of nested queries.
|
SearchQuery |
getWrappedQuery() |
int |
hashCode() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetBoostpublic static final String KEY
public FunctionScoreQuery(SearchQuery wrappedQuery, ScoreFunction function, FunctionScoreQuery.BoostMode boostMode)
public String getKey()
getKey in interface SearchQuerypublic List getParameters()
SearchQueryStrings or SearchQuerys.getParameters in interface SearchQueryStrings or SearchQuerys.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 SearchQuerypublic Stream<SubClause<SearchQuery>> getSubClauses()
SearchQuerygetSubClauses in interface SearchQueryCopyright © 2003–2022 Atlassian. All rights reserved.