org.apache.lucene.search.function
public class CustomScoreQuery extends Query
FieldScoreQuery
WARNING: The status of the search.function package is experimental. The APIs introduced here might change in the future and will not be supported anymore in such a case.
Constructor Summary | |
---|---|
CustomScoreQuery(Query subQuery)
Create a CustomScoreQuery over input subQuery. | |
CustomScoreQuery(Query subQuery, ValueSourceQuery valSrcQuery)
Create a CustomScoreQuery over input subQuery and a ValueSourceQuery. |
Method Summary | |
---|---|
Object | clone() |
protected Weight | createWeight(Searcher searcher) |
Explanation | customExplain(int doc, Explanation subQueryExpl, Explanation valSrcExpl)
Explain the custom score.
|
float | customScore(int doc, float subQueryScore, float valSrcScore)
Compute a custom score by the subQuery score and the ValueSourceQuery score.
|
boolean | equals(Object o) Returns true if o is equal to this. |
void | extractTerms(Set terms) |
int | hashCode() Returns a hash code value for this object. |
boolean | isStrict()
Checks if this is strict custom scoring.
|
String | name()
A short name of this query, used in toString. |
Query | rewrite(IndexReader reader) |
void | setStrict(boolean strict)
Set the strict mode of this query. |
String | toString(String field) |
Parameters: subQuery the sub query whose scored is being customed. Must not be null.
Parameters: subQuery the sub query whose score is being customed. Must not be null. valSrcQuery a value source query whose scores are used in the custom score
computation. For most simple/convineient use case this would be a
FieldScoreQuery
.
This parameter is optional - it can be null.
Parameters: doc doc being explained. subQueryExpl explanation for the sub-query part. valSrcExpl explanation for the value source part.
Returns: an explanation for the custom score
Subclasses can override this method to modify the custom score.
The default computation herein is:
ModifiedScore = valSrcScore * subQueryScore.
Parameters: doc id of scored doc. subQueryScore score of that doc by the subQuery. valSrcScore score of that doc by the ValueSourceQuery.
Returns: custom score.
o
is equal to this.Note: only has effect when the ValueSource part is not null.
Parameters: strict The strict mode to set.
See Also: isStrict