public Explanation explain(final AtomicReaderContext context, final int doc) throws IOException {
final NodeScorer scorer = (NodeScorer) this.scorer(context, true, false, context.reader().getLiveDocs());
if (scorer != null) {
if (scorer.skipToCandidate(doc) && scorer.doc() == doc) {
final ExactSimScorer docScorer = similarity.exactSimScorer(stats, context);
final ComplexExplanation result = new ComplexExplanation();
result.setDescription("weight("+this.getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
while (scorer.nextNode()) {
final ComplexExplanation nodeMatch = new ComplexExplanation();
nodeMatch.setDescription("in "+scorer.node()+"), result of:");
final float freq = scorer.freqInNode();
final Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "termFreq=" + freq));
nodeMatch.setValue(scoreExplanation.getValue());
nodeMatch.setMatch(true);
nodeMatch.addDetail(scoreExplanation);
result.addDetail(nodeMatch);
}