mirror of https://github.com/apache/lucene.git
make ScoreDocQueue final
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1145521 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e6dcad7e98
commit
d6724ddb84
|
@ -47,7 +47,7 @@ class DisjunctionSumScorer extends Scorer {
|
||||||
* <code>nrMatchers</code> is the number of matching scorers,
|
* <code>nrMatchers</code> is the number of matching scorers,
|
||||||
* and all scorers are after the matching doc, or are exhausted.
|
* and all scorers are after the matching doc, or are exhausted.
|
||||||
*/
|
*/
|
||||||
private ScorerDocQueue scorerDocQueue;
|
private final ScorerDocQueue scorerDocQueue;
|
||||||
|
|
||||||
/** The document number of the current match. */
|
/** The document number of the current match. */
|
||||||
private int currentDoc = -1;
|
private int currentDoc = -1;
|
||||||
|
@ -83,7 +83,7 @@ class DisjunctionSumScorer extends Scorer {
|
||||||
this.minimumNrMatchers = minimumNrMatchers;
|
this.minimumNrMatchers = minimumNrMatchers;
|
||||||
this.subScorers = subScorers;
|
this.subScorers = subScorers;
|
||||||
|
|
||||||
initScorerDocQueue();
|
scorerDocQueue = initScorerDocQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Construct a <code>DisjunctionScorer</code>, using one as the minimum number
|
/** Construct a <code>DisjunctionScorer</code>, using one as the minimum number
|
||||||
|
@ -95,14 +95,16 @@ class DisjunctionSumScorer extends Scorer {
|
||||||
|
|
||||||
/** Called the first time nextDoc() or advance() is called to
|
/** Called the first time nextDoc() or advance() is called to
|
||||||
* initialize <code>scorerDocQueue</code>.
|
* initialize <code>scorerDocQueue</code>.
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
private void initScorerDocQueue() throws IOException {
|
private ScorerDocQueue initScorerDocQueue() throws IOException {
|
||||||
scorerDocQueue = new ScorerDocQueue(nrScorers);
|
final ScorerDocQueue docQueue = new ScorerDocQueue(nrScorers);
|
||||||
for (Scorer se : subScorers) {
|
for (final Scorer se : subScorers) {
|
||||||
if (se.nextDoc() != NO_MORE_DOCS) {
|
if (se.nextDoc() != NO_MORE_DOCS) {
|
||||||
scorerDocQueue.insert(se);
|
docQueue.insert(se);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return docQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Scores and collects all matching documents.
|
/** Scores and collects all matching documents.
|
||||||
|
@ -138,6 +140,7 @@ class DisjunctionSumScorer extends Scorer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int nextDoc() throws IOException {
|
public int nextDoc() throws IOException {
|
||||||
|
|
||||||
if (scorerDocQueue.size() < minimumNrMatchers || !advanceAfterCurrent()) {
|
if (scorerDocQueue.size() < minimumNrMatchers || !advanceAfterCurrent()) {
|
||||||
currentDoc = NO_MORE_DOCS;
|
currentDoc = NO_MORE_DOCS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue