Package org.apache.lucene.search

# Class MaxScoreCache

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

public 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.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

## Constructor Summary

Constructors
Constructor
Description
`MaxScoreCache(ImpactsSource impactsSource, Similarity.SimScorer scorer)`
Sole constructor.

## Method Summary

Modifier and Type
Method
Description
`int`
`advanceShallow(int target)`
Implement the contract of `Scorer.advanceShallow(int)` based on the wrapped `ImpactsSource`.
`float`
`getMaxScore(int upTo)`
Return the maximum score up to upTo included.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### MaxScoreCache

public MaxScoreCache(ImpactsSource impactsSource, Similarity.SimScorer scorer)
Sole constructor.

## Method Details

### advanceShallow

public int advanceShallow(int target) throws IOException
Implement the contract of `Scorer.advanceShallow(int)` based on the wrapped `ImpactsSource`.

Throws:
  `IOException`
See Also:
  - `Scorer.advanceShallow(int)`

### getMaxScore

public float getMaxScore(int upTo) throws IOException
Return the maximum score up to upTo included.

Throws:
  `IOException`
See Also:
  - `Scorer.getMaxScore(int)`