Package org.apache.lucene.search
Class MaxScoreSumPropagator
java.lang.Object
org.apache.lucene.search.MaxScoreSumPropagator
Utility class to propagate scoring information in
BooleanQuery
, which compute the score
as the sum of the scores of its matching clauses. This helps propagate information about the
maximum produced score-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
advanceShallow
(int target) private static double[]
computeSumOfComplement
(float[] v) Return an array which, at index i, stores the sum of all entries ofv
except the one at index i.(package private) float
getMaxScore
(int upTo) private float
getMinCompetitiveScore
(float minScoreSum, double sumOfOtherMaxScores) Return the minimum score that a Scorer must produce in order for a hit to be competitive.(package private) float
scoreSumUpperBound
(double sum) (package private) void
setMinCompetitiveScore
(float minScore)
-
Field Details
-
numClauses
private final int numClauses -
scorers
-
sumOfOtherMaxScores
private final double[] sumOfOtherMaxScores
-
-
Constructor Details
-
MaxScoreSumPropagator
MaxScoreSumPropagator(Collection<? extends Scorer> scorerList) throws IOException - Throws:
IOException
-
-
Method Details
-
computeSumOfComplement
private static double[] computeSumOfComplement(float[] v) Return an array which, at index i, stores the sum of all entries ofv
except the one at index i. -
advanceShallow
- Throws:
IOException
-
getMaxScore
- Throws:
IOException
-
setMinCompetitiveScore
- Throws:
IOException
-
getMinCompetitiveScore
private float getMinCompetitiveScore(float minScoreSum, double sumOfOtherMaxScores) Return the minimum score that a Scorer must produce in order for a hit to be competitive.The way that boolean queries combine scores of their sub clauses together is by summing up the float scores into a double and finally casting back that double back to a float. This method undoes this operation by taking the float score sum and subtracting the sum of other scores as a double as a first approximation of the minimum score that this clause must have.
-
scoreSumUpperBound
float scoreSumUpperBound(double sum)
-