java.lang.Object
org.apache.lucene.search.MaxScoreCache
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final float
private final ImpactsSource
private float[]
private int[]
private final Similarity.SimScorer
-
Constructor Summary
ConstructorsConstructorDescriptionMaxScoreCache
(ImpactsSource impactsSource, Similarity.SimScorer scorer) Sole constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate float
computeMaxScore
(List<Impact> impacts) private void
ensureCacheSize
(int size) private int
getLevel
(int upTo) Return the first level that includes all doc IDs up toupTo
, or -1 if there is no such level.(package private) float
getMaxScore
(int upTo) private float
getMaxScoreForLevel
(int level) Return the maximum score for the givenlevel
.(package private) float
private int
getSkipLevel
(Impacts impacts, float minScore) Return the maximum level at which scores are all less thanminScore
, 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 thanminScore
, or-1
if the current document may be competitive.
-
Field Details
-
impactsSource
-
scorer
-
globalMaxScore
private final float globalMaxScore -
maxScoreCache
private float[] maxScoreCache -
maxScoreCacheUpTo
private int[] maxScoreCacheUpTo
-
-
Constructor Details
-
MaxScoreCache
Sole constructor.
-
-
Method Details
-
ensureCacheSize
private void ensureCacheSize(int size) -
computeMaxScore
-
getMaxScore
- Throws:
IOException
-
getLevel
Return the first level that includes all doc IDs up toupTo
, or -1 if there is no such level.- Throws:
IOException
-
getMaxScoreForLevelZero
- Throws:
IOException
-
getMaxScoreForLevel
Return the maximum score for the givenlevel
.- Throws:
IOException
-
getSkipLevel
Return the maximum level at which scores are all less thanminScore
, or -1 if none.- Throws:
IOException
-
getSkipUpTo
Return the an inclusive upper bound of documents that all have a score that is less thanminScore
, or-1
if the current document may be competitive.- Throws:
IOException
-