Class FunctionScoreQuery
- java.lang.Object
-
- com.atlassian.confluence.search.v2.query.FunctionScoreQuery
-
- All Implemented Interfaces:
Expandable<SearchQuery>
,SearchQuery
@SearchPrimitive public class FunctionScoreQuery extends Object implements SearchQuery
v2 primitive query that modifies the wrapped query score of a retrieved document by combining it according toFunctionScoreQuery.BoostMode
with an value provided byScoreFunction
.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); >
- Since:
- 7.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FunctionScoreQuery.BoostMode
-
Field Summary
Fields Modifier and Type Field Description static String
KEY
-
Fields inherited from interface com.atlassian.confluence.search.v2.SearchQuery
DEFAULT_BOOST
-
-
Constructor Summary
Constructors Constructor Description FunctionScoreQuery(SearchQuery wrappedQuery, ScoreFunction function, FunctionScoreQuery.BoostMode boostMode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
SearchQuery
expand()
This primitive but is similar toBooleanQuery
, 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 asString
s orSearchQuery
s.Stream<SubClause<SearchQuery>>
getSubClauses()
Returns a stream of nested queries.SearchQuery
getWrappedQuery()
int
hashCode()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.confluence.search.v2.SearchQuery
getBoost
-
-
-
-
Field Detail
-
KEY
public static final String KEY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FunctionScoreQuery
public FunctionScoreQuery(SearchQuery wrappedQuery, ScoreFunction function, FunctionScoreQuery.BoostMode boostMode)
-
-
Method Detail
-
getKey
public String getKey()
- Specified by:
getKey
in interfaceSearchQuery
- Returns:
- the plugin key
-
getParameters
public List getParameters()
Description copied from interface:SearchQuery
List of parameters asString
s orSearchQuery
s.- Specified by:
getParameters
in interfaceSearchQuery
- Returns:
String
s orSearchQuery
s.
-
getBoostMode
public FunctionScoreQuery.BoostMode getBoostMode()
-
getFunction
public ScoreFunction getFunction()
-
getWrappedQuery
public SearchQuery getWrappedQuery()
-
expand
public SearchQuery expand()
This primitive but is similar toBooleanQuery
, which in some sense primitive but also need to implement expand method, because the wrapped query need to be expanded.- Specified by:
expand
in interfaceExpandable<SearchQuery>
- Specified by:
expand
in interfaceSearchQuery
- Returns:
- a query
-
getSubClauses
public Stream<SubClause<SearchQuery>> getSubClauses()
Description copied from interface:SearchQuery
Returns a stream of nested queries.- Specified by:
getSubClauses
in interfaceSearchQuery
-
-