Methods Summary |
---|
public boolean | equals(java.lang.Object o)
if (this == o) return true;
if (!(o instanceof MultiTermQuery)) return false;
final MultiTermQuery multiTermQuery = (MultiTermQuery) o;
if (!term.equals(multiTermQuery.term)) return false;
return getBoost() == multiTermQuery.getBoost();
|
protected abstract org.apache.lucene.search.FilteredTermEnum | getEnum(org.apache.lucene.index.IndexReader reader)Construct the enumeration to be used, expanding the pattern term.
|
public org.apache.lucene.index.Term | getTerm()Returns the pattern term. return term;
|
public int | hashCode()
return term.hashCode() + Float.floatToRawIntBits(getBoost());
|
public org.apache.lucene.search.Query | rewrite(org.apache.lucene.index.IndexReader reader)
FilteredTermEnum enumerator = getEnum(reader);
BooleanQuery query = new BooleanQuery(true);
try {
do {
Term t = enumerator.term();
if (t != null) {
TermQuery tq = new TermQuery(t); // found a match
tq.setBoost(getBoost() * enumerator.difference()); // set the boost
query.add(tq, BooleanClause.Occur.SHOULD); // add to query
}
} while (enumerator.next());
} finally {
enumerator.close();
}
return query;
|
public java.lang.String | toString(java.lang.String field)Prints a user-readable version of this query.
StringBuffer buffer = new StringBuffer();
if (!term.field().equals(field)) {
buffer.append(term.field());
buffer.append(":");
}
buffer.append(term.text());
buffer.append(ToStringUtils.boost(getBoost()));
return buffer.toString();
|