mirror of https://github.com/apache/lucene.git
clean up BS2's Coordinator, use ctor instead of init, make coordFactors final
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1371630 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d5212c9ae2
commit
93ebd8d5bd
|
@ -41,16 +41,16 @@ class BooleanScorer2 extends Scorer {
|
|||
private final List<Scorer> prohibitedScorers;
|
||||
|
||||
private class Coordinator {
|
||||
float[] coordFactors = null;
|
||||
int maxCoord = 0; // to be increased for each non prohibited scorer
|
||||
int nrMatchers; // to be increased by score() of match counting scorers.
|
||||
final float coordFactors[];
|
||||
|
||||
void init(boolean disableCoord) { // use after all scorers have been added.
|
||||
Coordinator(int maxCoord, boolean disableCoord) {
|
||||
coordFactors = new float[optionalScorers.size() + requiredScorers.size() + 1];
|
||||
for (int i = 0; i < coordFactors.length; i++) {
|
||||
coordFactors[i] = disableCoord ? 1.0f : ((BooleanWeight)weight).coord(i, maxCoord);
|
||||
}
|
||||
}
|
||||
|
||||
int nrMatchers; // to be increased by score() of match counting scorers.
|
||||
}
|
||||
|
||||
private final Coordinator coordinator;
|
||||
|
@ -92,15 +92,13 @@ class BooleanScorer2 extends Scorer {
|
|||
if (minNrShouldMatch < 0) {
|
||||
throw new IllegalArgumentException("Minimum number of optional scorers should not be negative");
|
||||
}
|
||||
coordinator = new Coordinator();
|
||||
this.minNrShouldMatch = minNrShouldMatch;
|
||||
coordinator.maxCoord = maxCoord;
|
||||
|
||||
optionalScorers = optional;
|
||||
requiredScorers = required;
|
||||
prohibitedScorers = prohibited;
|
||||
coordinator = new Coordinator(maxCoord, disableCoord);
|
||||
|
||||
coordinator.init(disableCoord);
|
||||
countingSumScorer = makeCountingSumScorer(disableCoord);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue