There is a bug in PayloadNearQuery. If there are multiple top level spans that match the query, only the payloads of the first one are retrieved. This patch fixes this bug by iterating over all the top level spans to get the payloads (see 'setFreqCurrentDoc')
> The base explain method can't be abstract. Something like
Ah, right. This is included in the patch
>The changes don't seem thread safe any more since there are now member variables. It may still be all right, but have you looked at this aspect?
I guess that could be said about PayloadTermSpanScorer and PayloadNearSpanScorer, too (payloadScore, payloadsSeen). As for the PayloadFunction classes, they seem lightweight enough to be created with each query. Is there a better pattern?