ScoreCachingWrappingScorer

A Scorer which wraps another scorer and caches the score of the current document. Successive calls to .score will return the same result and will not invoke the wrapped Scorer's score() method, unless the current document has changed.

This class might be useful due to the changes done to the Collector interface, in which the score is not computed for a document by default, only if the collector requests it. Some collectors may need to use the score in several places, however all they have in hand is a [ ] object, and might end up computing the score of a document more than once.

Constructors

Link copied to clipboard
constructor(scorer: Scorable)

Types

Properties

Link copied to clipboard
Link copied to clipboard
open override var minCompetitiveScore: Float

Optional method: Tell the scorer that its iterator may safely ignore all documents whose score is less than the given minScore. This is a no-op by default.

Link copied to clipboard

Functions

Link copied to clipboard
open override fun score(): Float

Returns the score of the current document matching the query.

Link copied to clipboard
open fun smoothingScore(docId: Int): Float

Returns the smoothing score of the current document matching the query. This score is used when the query/term does not appear in the document, and behaves like an idf. The smoothing score is particularly important when the Scorer returns a product of probabilities so that the document score does not go to zero when one probability is zero. This can return 0 or a smoothing score.