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.booleanReturns true iffois equal to this.voidextractTerms(Set<Term> terms) Expert: adds all terms occurring in this query to the terms set.getTerm()Returns the term of this query.inthashCode()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:QueryExpert: Constructs an appropriate Weight implementation for this query.Only implemented by primitive queries, which re-write to themselves.
- Overrides:
createWeightin classQuery- Throws:
IOException
-
extractTerms
Description copied from class:QueryExpert: adds all terms occurring in this query to the terms set. Only works if this query is in itsrewrittenform.- Overrides:
extractTermsin classQuery
-
toString
Prints a user-readable version of this query. -
equals
Returns true iffois equal to this. -
hashCode
public int hashCode()Returns a hash code value for this object.
-