final class MaxScoreCache
extends java.lang.Object
Impacts and keep them in a cache in
order not to run expensive similarity score computations multiple times on
the same data.| Modifier and Type | Field and Description |
|---|---|
private ImpactsSource |
impactsSource |
private float[] |
maxScoreCache |
private int[] |
maxScoreCacheUpTo |
private Similarity.SimScorer |
scorer |
| Constructor and Description |
|---|
MaxScoreCache(ImpactsSource impactsSource,
Similarity.SimScorer scorer)
Sole constructor.
|
| Modifier and Type | Method and 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. |
private final ImpactsSource impactsSource
private final Similarity.SimScorer scorer
private float[] maxScoreCache
private int[] maxScoreCacheUpTo
public MaxScoreCache(ImpactsSource impactsSource, Similarity.SimScorer scorer)
private void ensureCacheSize(int size)
private float computeMaxScore(java.util.List<Impact> impacts)
int getLevel(int upTo)
throws java.io.IOException
upTo,
or -1 if there is no such level.java.io.IOExceptionfloat getMaxScoreForLevel(int level)
throws java.io.IOException
level.java.io.IOExceptionprivate int getSkipLevel(Impacts impacts, float minScore) throws java.io.IOException
minScore,
or -1 if none.java.io.IOExceptionint getSkipUpTo(float minScore)
throws java.io.IOException
minScore, or -1 if the current document may
be competitive.java.io.IOException