org.apache.lucene.search
public class: TermQuery [javadoc |
source]
java.lang.Object
org.apache.lucene.search.Query
org.apache.lucene.search.TermQuery
All Implemented Interfaces:
Cloneable, Serializable
Direct Known Subclasses:
FuzzyTermQuery
A Query that matches documents containing a term.
This may be combined with other terms with a
BooleanQuery .
Methods from org.apache.lucene.search.Query: |
---|
clone, combine, createWeight, equals, extractTerms, getBoost, getSimilarity, hashCode, mergeBooleanQueries, rewrite, setBoost, toString, toString, weight |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from org.apache.lucene.search.TermQuery Detail: |
public Weight createWeight(Searcher searcher) throws IOException {
return new TermWeight(searcher);
}
|
public boolean equals(Object o) {
if (!(o instanceof TermQuery))
return false;
TermQuery other = (TermQuery)o;
return (this.getBoost() == other.getBoost())
&& this.term.equals(other.term);
}
Returns true iff o is equal to this. |
public void extractTerms(Set<Term> terms) {
terms.add(getTerm());
}
|
public Term getTerm() {
return term;
}
Returns the term of this query. |
public int hashCode() {
return Float.floatToIntBits(getBoost()) ^ term.hashCode();
}
Returns a hash code value for this object. |
public String toString(String field) {
StringBuilder buffer = new StringBuilder();
if (!term.field().equals(field)) {
buffer.append(term.field());
buffer.append(":");
}
buffer.append(term.text());
buffer.append(ToStringUtils.boost(getBoost()));
return buffer.toString();
}
Prints a user-readable version of this query. |