TermQuery is the most commonly-used query object and is the foundation of many complex queries that Lucene can make use of.
Following is the declaration for org.apache.lucene.search.TermQuery class −
public class TermQuery extends Query
The following table shows a class constructor −
|S.No.||Constructor & Description|
Constructs a query for the term t.
The following table shows the different class methods −
|S.No.||Method & Description|
|1||void addDocument(Document doc)
Adds a document to this index.
|2||Weight createWeight(Searcher searcher)
Expert: Constructs an appropriate Weight implementation for this query.
|3||boolean equals(Object o)
Returns true iff o is equal to this.
|4||void extractTerms(Set<Term> terms)
Expert: adds all terms occurring in this query to the terms set.
Returns the term of this query.
Returns a hash code value for this object.
|7||String toString(String field)
Prints a user-readable version of this query.
This class inherits methods from the following classes −