public class ConstantScoreQuery extends Query
NOTE: if the wrapped filter is an instance of
CachingWrapperFilter
, you'll likely want to
enforce deletions in the filter (using either CachingWrapperFilter.DeletesMode.RECACHE
or CachingWrapperFilter.DeletesMode.DYNAMIC
).
Modifier and Type | Class and Description |
---|---|
protected class |
ConstantScoreQuery.ConstantScorer |
protected class |
ConstantScoreQuery.ConstantWeight |
Modifier and Type | Field and Description |
---|---|
protected Filter |
filter |
protected Query |
query |
Constructor and Description |
---|
ConstantScoreQuery(Filter filter)
Wraps a Filter as a Query.
|
ConstantScoreQuery(Query query)
Strips off scores from the passed in Query.
|
Modifier and Type | Method and Description |
---|---|
Weight |
createWeight(Searcher searcher)
Expert: Constructs an appropriate Weight implementation for this query.
|
boolean |
equals(Object o) |
void |
extractTerms(Set<Term> terms)
Expert: adds all terms occurring in this query to the terms set.
|
Filter |
getFilter()
Returns the encapsulated filter, returns
null if a query is wrapped. |
Query |
getQuery()
Returns the encapsulated query, returns
null if a filter is wrapped. |
int |
hashCode() |
Query |
rewrite(IndexReader reader)
Expert: called to re-write queries into primitive queries.
|
String |
toString(String field)
Prints a query to a string, with
field assumed to be the
default field and omitted. |
clone, combine, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weight
public ConstantScoreQuery(Query query)
public ConstantScoreQuery(Filter filter)
new ConstantScoreQuery(new QueryWrapperFilter(query))
, instead
use ConstantScoreQuery(Query)
!public Filter getFilter()
null
if a query is wrapped.public Query getQuery()
null
if a filter is wrapped.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 Weight createWeight(Searcher searcher) throws IOException
Query
Only implemented by primitive queries, which re-write to themselves.
createWeight
in class Query
IOException
public String toString(String field)
Query
field
assumed to be the
default field and omitted.
The representation used is one that is supposed to be readable
by QueryParser
. However,
there are the following limitations: