Index: DisjunctionSumScorer.java =================================================================== --- DisjunctionSumScorer.java (revision 225556) +++ DisjunctionSumScorer.java (working copy) @@ -149,6 +149,13 @@ nrMatchers = 1; do { // Until all subscorers are after currentDoc if (top.next()) { + if (top.doc() <= currentDoc) { + throw new AssertionError("Scorer: " + top + + "\n advanced from doc " + currentDoc + + " to doc " + top.doc() + + " after next() returned true." + ); + } scorerQueue.adjustTop(); } else { scorerQueue.pop(); @@ -167,6 +174,16 @@ } else { currentScore += top.score(); nrMatchers++; + if (nrMatchers > nrScorers) { + throw new AssertionError("nrMatchers: " + nrMatchers + + " bigger than nrScorers: " + nrScorers + + "\nminimumNrMatchers: " + minimumNrMatchers + + ", currentDoc: " + currentDoc + + ", currentScore: " + currentScore + + "\ntop: " + top + + "\nscorerQueue.size(): " + scorerQueue.size() + ); + } } } while (true);