Apache Lucene open-source search software
skipTo jumped one document too far
Christoph Goller360e7e234c74
diff --git a/src/java/org/apache/lucene/search/PhraseScorer.java b/src/java/org/apache/lucene/search/PhraseScorer.javaindex 6e3503f7e5c..0c4dfdbcb76 100644--- a/src/java/org/apache/lucene/search/PhraseScorer.java+++ b/src/java/org/apache/lucene/search/PhraseScorer.java@@ -58,7 +58,7 @@ abstract class PhraseScorer extends Scorer {public boolean next() throws IOException {if (firstTime) {- sort();+ init();firstTime = false;} else if (more) {more = last.next(); // trigger further scanning@@ -97,19 +97,19 @@ abstract class PhraseScorer extends Scorer {return more;}-protected abstract float phraseFreq() throws IOException;- private void sort() throws IOException {- pq.clear();- for (PhrasePositions pp = first; more && pp != null; pp = pp.next) {+ private void init() throws IOException {+ for (PhrasePositions pp = first; more && pp != null; pp = pp.next)more = pp.next();- if (more) {- pq.put(pp);- } else {- return;- }- }+ if(more)+ sort();+ }++ private void sort() {+ pq.clear();+ for (PhrasePositions pp = first; pp != null; pp = pp.next)+ pq.put(pp);pqToList();}