org.apache.lucene.search.payloads
public class: PayloadTermQuery [javadoc |
source]
java.lang.Object
org.apache.lucene.search.Query
org.apache.lucene.search.spans.SpanQuery
org.apache.lucene.search.spans.SpanTermQuery
org.apache.lucene.search.payloads.PayloadTermQuery
All Implemented Interfaces:
Cloneable, Serializable
This class is very similar to
org.apache.lucene.search.spans.SpanTermQuery except that it factors
in the value of the payload located at each of the positions where the
org.apache.lucene.index.Term occurs.
In order to take advantage of this, you must override
org.apache.lucene.search.Similarity#scorePayload(int, String, int, int, byte[],int,int)
which returns 1 by default.
Payload scores are aggregated using a pluggable PayloadFunction .
Field Summary |
---|
protected PayloadFunction | function | |
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.payloads.PayloadTermQuery Detail: |
public Weight createWeight(Searcher searcher) throws IOException {
return new PayloadTermWeight(this, searcher);
}
|
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
PayloadTermQuery other = (PayloadTermQuery) obj;
if (function == null) {
if (other.function != null)
return false;
} else if (!function.equals(other.function))
return false;
if (includeSpanScore != other.includeSpanScore)
return false;
return true;
}
|
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((function == null) ? 0 : function.hashCode());
result = prime * result + (includeSpanScore ? 1231 : 1237);
return result;
}
|