blob: 9380689f7fe3e790bbb845e58e94821bfb9a4a6e [file] [log] [blame]
Index: lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java
===================================================================
--- lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java (revision 1386733)
+++ lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java (working copy)
@@ -190,6 +190,7 @@
@Override
public float score() throws IOException {
+ assert docIdSetIterator.docID() != NO_MORE_DOCS;
return theScore;
}
Index: lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
===================================================================
--- lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java (revision 1386733)
+++ lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java (working copy)
@@ -68,6 +68,7 @@
@Override
public int nextDoc() throws IOException {
+ assert doc != NO_MORE_DOCS;
while(true) {
while (subScorers[0].docID() == doc) {
if (subScorers[0].nextDoc() != NO_MORE_DOCS) {
@@ -91,10 +92,14 @@
private void afterNext() throws IOException {
final Scorer sub = subScorers[0];
doc = sub.docID();
- score = sub.score();
- nrMatchers = 1;
- countMatches(1);
- countMatches(2);
+ if (doc == NO_MORE_DOCS) {
+ nrMatchers = Integer.MAX_VALUE; // stop looping
+ } else {
+ score = sub.score();
+ nrMatchers = 1;
+ countMatches(1);
+ countMatches(2);
+ }
}
// TODO: this currently scores, but so did the previous impl