Class MaxScoreSumPropagator

java.lang.Object
org.apache.lucene.search.MaxScoreSumPropagator

final class MaxScoreSumPropagator extends Object
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 Details

    • numClauses

      private final int numClauses
    • scorers

      private final Scorer[] scorers
    • sumOfOtherMaxScores

      private final double[] sumOfOtherMaxScores
  • Constructor Details

  • Method Details

    • computeSumOfComplement

      private static double[] computeSumOfComplement(float[] v)
      Return an array which, at index i, stores the sum of all entries of v except the one at index i.
    • advanceShallow

      void advanceShallow(int target) throws IOException
      Throws:
      IOException
    • getMaxScore

      float getMaxScore(int upTo) throws IOException
      Throws:
      IOException
    • setMinCompetitiveScore

      void setMinCompetitiveScore(float minScore) throws IOException
      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)