I'm using BoostingTermQuery to boost the score of documents with terms containing payloads (boost value > 1). I'd like to change the scoring behavior such that if a query contains multiple BoostingTermQuery terms (either required or optional), documents containing more matching terms with payloads always score higher than documents with fewer terms with payloads. Currently, if one of the terms has a high IDF weight and contains a boosting payload but no payloads on other matching terms, it may score higher than docs with other matching terms with payloads and lower IDF.
I think what I need is a way to increase the weight of a matching term in BoostingSpanScorer.score() if 'payloadsSeen > 0', but I don't see how to do this. Any suggestions? Thanks, Peter