Lucene - Query
Query is an abstract class and contains various utility methods and is the parent of all types of queries that Lucene uses during search process.
Following is the declaration for org.apache.lucene.search.Query class −
public abstract class Query extends Object implements Serializable, Cloneable
The following table shows a class constructor −
|S.No.||Constructor & Description|
The following table shows the different class methods −
|S.No.||Method & Description|
Returns a clone of this query.
Query combine(Query queries)
Expert: Called when re-writing queries under MultiSearcher.
Weight createWeight(Searcher searcher)
Expert: Constructs an appropriate Weight implementation for this query.
boolean equals(Object obj)
void extractTerms(Set<Term> terms)
Expert: Adds all terms occurring in this query to the terms set.
Gets the boost for this clause.
Similarity getSimilarity(Searcher searcher)
Deprecated. Instead of using "runtime" subclassing/delegation, subclass the Weight instead.
static Query mergeBooleanQueries(BooleanQuery... queries)
Expert: Merges the clauses of a set of BooleanQuery's into a single BooleanQuery.
Query rewrite(IndexReader reader)
Expert: Called to re-write queries into primitive queries.
void setBoost(float b)
Sets the boost for this query clause to b.
Prints a query to a string.
abstract String toString(String field)
Prints a query to a string, with field assumed to be the default field and omitted.
Weight weight(Searcher searcher)
Deprecated. Never ever use this method in Weight implementations. Subclasses of Query should use createWeight(org.apache.lucene.search.Searcher), instead.
This class inherits methods from the following classes −