public class CustomScoreQuery extends Query implements Cloneable
FunctionQuery (or queries).getCustomScoreProvider(org.apache.lucene.index.LeafReaderContext).| Constructor and Description |
|---|
CustomScoreQuery(Query subQuery)
Create a CustomScoreQuery over input subQuery.
|
CustomScoreQuery(Query subQuery,
FunctionQuery... scoringQueries)
Create a CustomScoreQuery over input subQuery and a
FunctionQuery. |
CustomScoreQuery(Query subQuery,
FunctionQuery scoringQuery)
Create a CustomScoreQuery over input subQuery and a
FunctionQuery. |
| Modifier and Type | Method and Description |
|---|---|
CustomScoreQuery |
clone() |
Weight |
createWeight(IndexSearcher searcher,
boolean needsScores,
float boost) |
boolean |
equals(Object other)
Returns true if
o is equal to this. |
protected CustomScoreProvider |
getCustomScoreProvider(LeafReaderContext context)
Returns a
CustomScoreProvider that calculates the custom scores
for the given IndexReader. |
Query[] |
getScoringQueries()
The scoring queries that only affect the score of CustomScoreQuery.
|
Query |
getSubQuery()
The sub-query that CustomScoreQuery wraps, affecting both the score and which documents match.
|
int |
hashCode()
Returns a hash code value for this object.
|
String |
name()
A short name of this query, used in
toString(String). |
Query |
rewrite(IndexReader reader) |
String |
toString(String field) |
classHash, sameClassAs, toStringpublic CustomScoreQuery(Query subQuery)
subQuery - the sub query whose scored is being customized. Must not be null.public CustomScoreQuery(Query subQuery, FunctionQuery scoringQuery)
FunctionQuery.subQuery - the sub query whose score is being customized. Must not be null.scoringQuery - a value source query whose scores are used in the custom score
computation. This parameter is optional - it can be null.public CustomScoreQuery(Query subQuery, FunctionQuery... scoringQueries)
FunctionQuery.subQuery - the sub query whose score is being customized. Must not be null.scoringQueries - value source queries whose scores are used in the custom score
computation. This parameter is optional - it can be null or even an empty array.public Query rewrite(IndexReader reader) throws IOException
rewrite in class QueryIOExceptionpublic CustomScoreQuery clone()
public boolean equals(Object other)
o is equal to this.public int hashCode()
protected CustomScoreProvider getCustomScoreProvider(LeafReaderContext context) throws IOException
CustomScoreProvider that calculates the custom scores
for the given IndexReader. The default implementation returns a default
implementation as specified in the docs of CustomScoreProvider.IOExceptionpublic Weight createWeight(IndexSearcher searcher, boolean needsScores, float boost) throws IOException
createWeight in class QueryIOExceptionpublic Query getSubQuery()
public Query[] getScoringQueries()
public String name()
toString(String).Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.