| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.lucene.search.Query
org.apache.lucene.search.ConstantScoreQuery
public class ConstantScoreQuery
A query that wraps another query or a filter and simply returns a constant score equal to the query boost for every document that matches the filter or query. For queries it therefore simply strips of all scores and returns a constant one.
| Nested Class Summary | |
|---|---|
| protected  class | ConstantScoreQuery.ConstantScorer | 
| protected  class | ConstantScoreQuery.ConstantWeight | 
| Field Summary | |
|---|---|
| protected  Filter | filter | 
| protected  Query | query | 
| Constructor Summary | |
|---|---|
| ConstantScoreQuery(Filter filter)Wraps a Filter as a Query. | |
| ConstantScoreQuery(Query query)Strips off scores from the passed in Query. | |
| Method Summary | |
|---|---|
|  Weight | createWeight(IndexSearcher 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 nullif a query is wrapped. | 
|  Query | getQuery()Returns the encapsulated query, returns nullif 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 fieldassumed to be the 
 default field and omitted. | 
| Methods inherited from class org.apache.lucene.search.Query | 
|---|
| clone, getBoost, setBoost, toString | 
| Methods inherited from class java.lang.Object | 
|---|
| finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
protected final Filter filter
protected final Query query
| Constructor Detail | 
|---|
public ConstantScoreQuery(Query query)
public ConstantScoreQuery(Filter filter)
new ConstantScoreQuery(new QueryWrapperFilter(query)), instead
 use ConstantScoreQuery(Query)!
| Method Detail | 
|---|
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 QueryIOExceptionpublic void extractTerms(Set<Term> terms)
Queryrewritten form.
extractTerms in class Query
public Weight createWeight(IndexSearcher searcher)
                    throws IOException
QueryOnly implemented by primitive queries, which re-write to themselves.
createWeight in class QueryIOExceptionpublic String toString(String field)
Queryfield assumed to be the 
 default field and omitted.
toString in class Querypublic boolean equals(Object o)
equals in class Querypublic int hashCode()
hashCode in class Query| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||