public class CustomScoreQuery extends Query
FunctionQuery
(or queries).getCustomScoreProvider(org.apache.lucene.index.AtomicReaderContext)
.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()
Returns a clone of this query.
|
Weight |
createWeight(IndexSearcher searcher)
Expert: Constructs an appropriate Weight implementation for this query.
|
boolean |
equals(Object o)
Returns true if
o is equal to this. |
void |
extractTerms(Set<Term> terms)
Expert: adds all terms occurring in this query to the terms set.
|
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.
|
boolean |
isStrict()
Checks if this is strict custom scoring.
|
String |
name()
A short name of this query, used in
toString(String) . |
Query |
rewrite(IndexReader reader)
Expert: called to re-write queries into primitive queries.
|
void |
setStrict(boolean strict)
Set the strict mode of this query.
|
String |
toString(String field)
Prints a query to a string, with
field assumed to be the
default field and omitted. |
public 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
Query
rewrite
in class Query
IOException
public void extractTerms(Set<Term> terms)
Query
rewritten
form.extractTerms
in class Query
public CustomScoreQuery clone()
Query
public String toString(String field)
Query
field
assumed to be the
default field and omitted.public boolean equals(Object o)
o
is equal to this.public int hashCode()
public Weight createWeight(IndexSearcher searcher) throws IOException
Query
Only implemented by primitive queries, which re-write to themselves.
createWeight
in class Query
IOException
public boolean isStrict()
ValueSource
part does not participate in weight normalization.
This may be useful when one wants full control over how scores are modified, and does
not care about normalizing by the ValueSource
part.
One particular case where this is useful if for testing this query.
Note: only has effect when the ValueSource
part is not null.
public void setStrict(boolean strict)
strict
- The strict mode to set.isStrict()
public Query getSubQuery()
public Query[] getScoringQueries()
public String name()
toString(String)
.Copyright © 2010 - 2020 Adobe. All Rights Reserved