Lucene - Searching Classes-Term Query - Lucene

What is Lucene Team Query?

TermQuery is the most commonly-used query object and is the foundation of many complex queries that Lucene can make use of.

Class Declaration

Following is the declaration for org.apache.lucene.search.TermQuery class −

Class Constructors

The following table shows a class constructor −

S.No. Constructor & Description
1
TermQuery(Term t)
Constructs a query for the term t.

Class Methods

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.
5 Term getTerm()
Returns the term of this query.
6 int hashCode()
Returns a hash code value for this object.
7 String toString(String field)
Prints a user-readable version of this query.

Methods Inherited

This class inherits methods from the following classes −

  • org.apache.lucene.search.Query
  • java.lang.Object

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Lucene Topics