// check that this is done on a field that has payloads
if (payloadFields.contains(term.field()) == false)
return input;
output = new PayloadTermQuery(term, func);
}
// rewrite PhraseQueries
else if (input instanceof PhraseQuery) {
PhraseQuery pin = (PhraseQuery) input;
Term[] terms = pin.getTerms();
int slop = pin.getSlop();
boolean inorder = false;
// check that this is done on a field that has payloads
if (terms.length > 0
&& payloadFields.contains(terms[0].field()) == false)
return input;
SpanQuery[] clauses = new SpanQuery[terms.length];
// phrase queries : keep the default function i.e. average
for (int i = 0; i < terms.length; i++)
clauses[i] = new PayloadTermQuery(terms[i], func);
output = new PayloadNearQuery(clauses, slop, inorder);
}
// recursively rewrite DJMQs
else if (input instanceof DisjunctionMaxQuery) {