Lucene - TermQuery


Advertisements


Introduction

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:

public class TermQuery
   extends Query

Class constructors

S.N.Constructor & Description
1

TermQuery(Term t)

Constructs a query for the term t.

Class methods

S.N.Method & Description
1void addDocument(Document doc)

Adds a document to this index.

2Weight createWeight(Searcher searcher)

Expert: Constructs an appropriate Weight implementation for this query.

3boolean equals(Object o)

Returns true iff o is equal to this.

4void extractTerms(Set<Term> terms)

Expert: adds all terms occurring in this query to the terms set.

5Term getTerm()

Returns the term of this query.

6int hashCode()

Returns a hash code value for this object.

7String 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


lucene_searching_classes.htm

Advertisements