mirror of https://github.com/apache/lucene.git
Fixed a recently introduced bug in BooleanScorer; added some toString() methods to facilitate debugging.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150202 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
32d5bcd950
commit
84d2f6994c
|
@ -130,7 +130,7 @@ final class BooleanScorer extends Scorer {
|
|||
public int doc() { return current.doc; }
|
||||
|
||||
public boolean next() throws IOException {
|
||||
boolean more = false;
|
||||
boolean more;
|
||||
do {
|
||||
while (bucketTable.first != null) { // more queued
|
||||
current = bucketTable.first;
|
||||
|
@ -144,6 +144,7 @@ final class BooleanScorer extends Scorer {
|
|||
}
|
||||
|
||||
// refill the queue
|
||||
more = false;
|
||||
end += BucketTable.SIZE;
|
||||
for (SubScorer sub = scorers; sub != null; sub = sub.next) {
|
||||
Scorer scorer = sub.scorer;
|
||||
|
@ -152,10 +153,11 @@ final class BooleanScorer extends Scorer {
|
|||
sub.done = !scorer.next();
|
||||
}
|
||||
if (!sub.done) {
|
||||
more = true;
|
||||
more = true;
|
||||
}
|
||||
}
|
||||
} while (bucketTable.first != null | more);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -247,4 +249,16 @@ final class BooleanScorer extends Scorer {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("boolean(");
|
||||
for (SubScorer sub = scorers; sub != null; sub = sub.next) {
|
||||
buffer.append(sub.scorer.toString());
|
||||
buffer.append(" ");
|
||||
}
|
||||
buffer.append(")");
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -117,6 +117,8 @@ public class PhraseQuery extends Query {
|
|||
this.searcher = searcher;
|
||||
}
|
||||
|
||||
public String toString() { return "weight(" + PhraseQuery.this + ")"; }
|
||||
|
||||
public Query getQuery() { return PhraseQuery.this; }
|
||||
public float getValue() { return value; }
|
||||
|
||||
|
|
|
@ -183,4 +183,6 @@ abstract class PhraseScorer extends Scorer {
|
|||
return tfExplanation;
|
||||
}
|
||||
|
||||
public String toString() { return "scorer(" + weight + ")"; }
|
||||
|
||||
}
|
||||
|
|
|
@ -76,6 +76,8 @@ public class TermQuery extends Query {
|
|||
this.searcher = searcher;
|
||||
}
|
||||
|
||||
public String toString() { return "weight(" + TermQuery.this + ")"; }
|
||||
|
||||
public Query getQuery() { return TermQuery.this; }
|
||||
public float getValue() { return value; }
|
||||
|
||||
|
|
|
@ -157,4 +157,7 @@ final class TermScorer extends Scorer {
|
|||
|
||||
return tfExplanation;
|
||||
}
|
||||
|
||||
public String toString() { return "scorer(" + weight + ")"; }
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue