Methods Summary |
---|
public boolean | equals(java.lang.Object o)Returns true iff o is equal to this.
if (this == o) return true;
if (!(o instanceof SpanNearQuery)) return false;
final SpanNearQuery spanNearQuery = (SpanNearQuery) o;
if (inOrder != spanNearQuery.inOrder) return false;
if (slop != spanNearQuery.slop) return false;
if (!clauses.equals(spanNearQuery.clauses)) return false;
return getBoost() == spanNearQuery.getBoost();
|
public org.apache.lucene.search.spans.SpanQuery[] | getClauses()Return the clauses whose spans are matched.
return (SpanQuery[])clauses.toArray(new SpanQuery[clauses.size()]);
|
public java.lang.String | getField() return field;
|
public int | getSlop()Return the maximum number of intervening unmatched positions permitted. return slop;
|
public org.apache.lucene.search.spans.Spans | getSpans(org.apache.lucene.index.IndexReader reader)
if (clauses.size() == 0) // optimize 0-clause case
return new SpanOrQuery(getClauses()).getSpans(reader);
if (clauses.size() == 1) // optimize 1-clause case
return ((SpanQuery)clauses.get(0)).getSpans(reader);
return new NearSpans(this, reader);
|
public java.util.Collection | getTerms()
Collection terms = new ArrayList();
Iterator i = clauses.iterator();
while (i.hasNext()) {
SpanQuery clause = (SpanQuery)i.next();
terms.addAll(clause.getTerms());
}
return terms;
|
public int | hashCode()
int result;
result = clauses.hashCode();
// Mix bits before folding in things like boost, since it could cancel the
// last element of clauses. This particular mix also serves to
// differentiate SpanNearQuery hashcodes from others.
result ^= (result << 14) | (result >>> 19); // reversible
result += Float.floatToRawIntBits(getBoost());
result += slop;
result ^= (inOrder ? 0x99AFD3BD : 0);
return result;
|
public boolean | isInOrder()Return true if matches are required to be in-order. return inOrder;
|
public org.apache.lucene.search.Query | rewrite(org.apache.lucene.index.IndexReader reader)
SpanNearQuery clone = null;
for (int i = 0 ; i < clauses.size(); i++) {
SpanQuery c = (SpanQuery)clauses.get(i);
SpanQuery query = (SpanQuery) c.rewrite(reader);
if (query != c) { // clause rewrote: must clone
if (clone == null)
clone = (SpanNearQuery) this.clone();
clone.clauses.set(i,query);
}
}
if (clone != null) {
return clone; // some clauses rewrote
} else {
return this; // no clauses rewrote
}
|
public java.lang.String | toString(java.lang.String field)
StringBuffer buffer = new StringBuffer();
buffer.append("spanNear([");
Iterator i = clauses.iterator();
while (i.hasNext()) {
SpanQuery clause = (SpanQuery)i.next();
buffer.append(clause.toString(field));
if (i.hasNext()) {
buffer.append(", ");
}
}
buffer.append("], ");
buffer.append(slop);
buffer.append(", ");
buffer.append(inOrder);
buffer.append(")");
buffer.append(ToStringUtils.boost(getBoost()));
return buffer.toString();
|