Class MaxScoreCache

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

final class MaxScoreCache extends Object
Compute maximum scores based on Impacts and keep them in a cache in order not to run expensive similarity score computations multiple times on the same data.
  • Field Details

    • impactsSource

      private final ImpactsSource impactsSource
    • scorer

      private final Similarity.SimScorer scorer
    • maxScoreCache

      private float[] maxScoreCache
    • maxScoreCacheUpTo

      private int[] maxScoreCacheUpTo
  • Constructor Details

  • Method Details

    • ensureCacheSize

      private void ensureCacheSize(int size)
    • computeMaxScore

      private float computeMaxScore(List<Impact> impacts)
    • getLevel

      int getLevel(int upTo) throws IOException
      Return the first level that includes all doc IDs up to upTo, or -1 if there is no such level.
      Throws:
      IOException
    • getMaxScoreForLevel

      float getMaxScoreForLevel(int level) throws IOException
      Return the maximum score for the given level.
      Throws:
      IOException
    • getSkipLevel

      private int getSkipLevel(Impacts impacts, float minScore) throws IOException
      Return the maximum level at which scores are all less than minScore, or -1 if none.
      Throws:
      IOException
    • getSkipUpTo

      int getSkipUpTo(float minScore) throws IOException
      Return the an inclusive upper bound of documents that all have a score that is less than minScore, or -1 if the current document may be competitive.
      Throws:
      IOException