public class PayloadTermQuery extends SpanTermQuery
SpanTermQuery
except that it factors
in the value of the payload located at each of the positions where the
Term
occurs.
NOTE: In order to take advantage of this with the default scoring implementation
(DefaultSimilarity
), you must override DefaultSimilarity.scorePayload(int, int, int, BytesRef)
,
which returns 1 by default.
Payload scores are aggregated using a pluggable PayloadFunction
.
Modifier and Type | Class and Description |
---|---|
protected class |
PayloadTermQuery.PayloadTermWeight |
Modifier and Type | Field and Description |
---|---|
protected PayloadFunction |
function |
term
Constructor and Description |
---|
PayloadTermQuery(Term term,
PayloadFunction function) |
PayloadTermQuery(Term term,
PayloadFunction function,
boolean includeSpanScore) |
Modifier and Type | Method and Description |
---|---|
Weight |
createWeight(IndexSearcher searcher,
boolean needsScores)
Expert: Constructs an appropriate Weight implementation for this query.
|
boolean |
equals(Object obj) |
int |
hashCode() |
extractTerms, getField, getSpans, getTerm, toString
protected PayloadFunction function
public PayloadTermQuery(Term term, PayloadFunction function)
public PayloadTermQuery(Term term, PayloadFunction function, boolean includeSpanScore)
public Weight createWeight(IndexSearcher searcher, boolean needsScores) throws IOException
Query
Only implemented by primitive queries, which re-write to themselves.
createWeight
in class SpanQuery
needsScores
- True if document scores (Scorer.score()
) or match
frequencies (Scorer.freq()
) are needed.IOException
public int hashCode()
hashCode
in class SpanTermQuery
public boolean equals(Object obj)
equals
in class SpanTermQuery
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.