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 {
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();
}