public Explanation explain(AtomicReaderContext context, int doc) throws IOException { Explanation mainExplain = mainWeight.explain(context, doc); return new QueryRescorer(reRankQuery) { @Override protected float combine(float firstPassScore, boolean secondPassMatches, float secondPassScore) { float score = firstPassScore; if (secondPassMatches) { score += reRankWeight * secondPassScore; } return score; } }.explain(searcher, mainExplain, context.docBase+doc); }