skipTo jumped one document too far

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150281 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Christoph Goller 2004-04-07 16:40:34 +00:00
parent 17338f4680
commit 360e7e234c
1 changed files with 11 additions and 11 deletions

View File

@ -58,7 +58,7 @@ abstract class PhraseScorer extends Scorer {
public boolean next() throws IOException { public boolean next() throws IOException {
if (firstTime) { if (firstTime) {
sort(); init();
firstTime = false; firstTime = false;
} else if (more) { } else if (more) {
more = last.next(); // trigger further scanning more = last.next(); // trigger further scanning
@ -97,19 +97,19 @@ abstract class PhraseScorer extends Scorer {
return more; return more;
} }
protected abstract float phraseFreq() throws IOException; protected abstract float phraseFreq() throws IOException;
private void sort() throws IOException { private void init() throws IOException {
pq.clear(); for (PhrasePositions pp = first; more && pp != null; pp = pp.next)
for (PhrasePositions pp = first; more && pp != null; pp = pp.next) {
more = pp.next(); more = pp.next();
if (more) { if(more)
pq.put(pp); sort();
} else { }
return;
} private void sort() {
} pq.clear();
for (PhrasePositions pp = first; pp != null; pp = pp.next)
pq.put(pp);
pqToList(); pqToList();
} }