Package org.apache.lucene.search
Class TermQuery
java.lang.Object
org.apache.lucene.search.Query
org.apache.lucene.search.TermQuery
- All Implemented Interfaces:
Cloneable
A Query that matches documents containing a term.
This may be combined with other terms with a
BooleanQuery
.-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a query for the termt
.Expert: constructs a TermQuery that will use the provided docFreq instead of looking up the docFreq against the searcher.TermQuery
(Term t, TermContext states) Expert: constructs a TermQuery that will use the provided docFreq instead of looking up the docFreq against the searcher. -
Method Summary
Modifier and TypeMethodDescriptioncreateWeight
(IndexSearcher searcher) Expert: Constructs an appropriate Weight implementation for this query.boolean
Returns true iffo
is equal to this.void
extractTerms
(Set<Term> terms) Expert: adds all terms occurring in this query to the terms set.getTerm()
Returns the term of this query.int
hashCode()
Returns a hash code value for this object.Prints a user-readable version of this query.
-
Constructor Details
-
TermQuery
Constructs a query for the termt
. -
TermQuery
Expert: constructs a TermQuery that will use the provided docFreq instead of looking up the docFreq against the searcher. -
TermQuery
Expert: constructs a TermQuery that will use the provided docFreq instead of looking up the docFreq against the searcher.
-
-
Method Details
-
getTerm
Returns the term of this query. -
createWeight
Description copied from class:Query
Expert: Constructs an appropriate Weight implementation for this query.Only implemented by primitive queries, which re-write to themselves.
- Overrides:
createWeight
in classQuery
- Throws:
IOException
-
extractTerms
Description copied from class:Query
Expert: adds all terms occurring in this query to the terms set. Only works if this query is in itsrewritten
form.- Overrides:
extractTerms
in classQuery
-
toString
Prints a user-readable version of this query. -
equals
Returns true iffo
is equal to this. -
hashCode
public int hashCode()Returns a hash code value for this object.
-