public class

TermQuery

extends Query
java.lang.Object
   ↳ org.apache.lucene.search.Query
     ↳ org.apache.lucene.search.TermQuery

Class Overview

A Query that matches documents containing a term. This may be combined with other terms with a BooleanQuery.

Summary

Public Constructors
TermQuery(Term t)
Constructs a query for the term t.
Public Methods
Weight createWeight(Searcher searcher)
Expert: Constructs an appropriate Weight implementation for this query.
boolean equals(Object o)
Returns true iff o is equal to this.
void extractTerms(Set<Term> terms)
Expert: adds all terms occurring in this query to the terms set.
Term getTerm()
Returns the term of this query.
int hashCode()
Returns a hash code value for this object.
String toString(String field)
Prints a user-readable version of this query.
[Expand]
Inherited Methods
From class org.apache.lucene.search.Query
From class java.lang.Object

Public Constructors

public TermQuery (Term t)

Constructs a query for the term t.

Public Methods

public Weight createWeight (Searcher searcher)

Expert: Constructs an appropriate Weight implementation for this query.

Only implemented by primitive queries, which re-write to themselves.

Throws
IOException

public boolean equals (Object o)

Returns true iff o is equal to this.

public void extractTerms (Set<Term> terms)

Expert: adds all terms occurring in this query to the terms set. Only works if this query is in its rewritten form.

public Term getTerm ()

Returns the term of this query.

public int hashCode ()

Returns a hash code value for this object.

public String toString (String field)

Prints a user-readable version of this query.