Methods Summary |
---|
public int | doc()
return reqScorer.doc(); // reqScorer may be null when next() or skipTo() already return false
|
public org.apache.lucene.search.Explanation | explain(int doc)
Explanation res = new Explanation();
if (exclScorer.skipTo(doc) && (exclScorer.doc() == doc)) {
res.setDescription("excluded");
} else {
res.setDescription("not excluded");
res.addDetail(reqScorer.explain(doc));
}
return res;
|
public boolean | next()
if (firstTime) {
if (! exclScorer.next()) {
exclScorer = null; // exhausted at start
}
firstTime = false;
}
if (reqScorer == null) {
return false;
}
if (! reqScorer.next()) {
reqScorer = null; // exhausted, nothing left
return false;
}
if (exclScorer == null) {
return true; // reqScorer.next() already returned true
}
return toNonExcluded();
|
public float | score()Returns the score of the current document matching the query.
Initially invalid, until {@link #next()} is called the first time.
return reqScorer.score(); // reqScorer may be null when next() or skipTo() already return false
|
public boolean | skipTo(int target)Skips to the first match beyond the current whose document number is
greater than or equal to a given target.
When this method is used the {@link #explain(int)} method should not be used.
if (firstTime) {
firstTime = false;
if (! exclScorer.skipTo(target)) {
exclScorer = null; // exhausted
}
}
if (reqScorer == null) {
return false;
}
if (exclScorer == null) {
return reqScorer.skipTo(target);
}
if (! reqScorer.skipTo(target)) {
reqScorer = null;
return false;
}
return toNonExcluded();
|
private boolean | toNonExcluded()Advance to non excluded doc.
On entry:
- reqScorer != null,
- exclScorer != null,
- reqScorer was advanced once via next() or skipTo()
and reqScorer.doc() may still be excluded.
Advances reqScorer a non excluded required doc, if any.
int exclDoc = exclScorer.doc();
do {
int reqDoc = reqScorer.doc(); // may be excluded
if (reqDoc < exclDoc) {
return true; // reqScorer advanced to before exclScorer, ie. not excluded
} else if (reqDoc > exclDoc) {
if (! exclScorer.skipTo(reqDoc)) {
exclScorer = null; // exhausted, no more exclusions
return true;
}
exclDoc = exclScorer.doc();
if (exclDoc > reqDoc) {
return true; // not excluded
}
}
} while (reqScorer.next());
reqScorer = null; // exhausted, nothing left
return false;
|