Class MaxScoreCache


  • final class MaxScoreCache
    extends java.lang.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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private float computeMaxScore​(java.util.List<Impact> impacts)  
      private void ensureCacheSize​(int size)  
      (package private) int getLevel​(int upTo)
      Return the first level that includes all doc IDs up to upTo, or -1 if there is no such level.
      (package private) float getMaxScoreForLevel​(int level)
      Return the maximum score for the given level.
      private int getSkipLevel​(Impacts impacts, float minScore)
      Return the maximum level at which scores are all less than minScore, or -1 if none.
      (package private) int getSkipUpTo​(float minScore)
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • maxScoreCache

        private float[] maxScoreCache
      • maxScoreCacheUpTo

        private int[] maxScoreCacheUpTo
    • Method Detail

      • ensureCacheSize

        private void ensureCacheSize​(int size)
      • computeMaxScore

        private float computeMaxScore​(java.util.List<Impact> impacts)
      • getLevel

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

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

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

        int getSkipUpTo​(float minScore)
                 throws java.io.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:
        java.io.IOException