Weight
Expert: Calculate query weights and build query scorers.
The purpose of Weight is to ensure searching does not modify a Query, so that a Query instance can be reused.
IndexSearcher dependent state of the query should reside in the Weight.
org.gnit.lucenekmp.index.LeafReader dependent state should reside in the [ ].
Since Weight creates Scorer instances for a given [ ] (.scorer) callers must maintain the relationship between the searcher's top-level IndexReaderContext and the context used to create a Scorer.
A Weight is used in the following way:
A
Weightis constructed by a top-level query, given aIndexSearcher* (Query.createWeight).A
Scoreris constructed by .scorer.
Since
2.9
Inheritors
Functions
Helper method that delegates to .scorerSupplier. It is implemented as
Counts the number of live documents that match a given this.query in a leaf.
An explanation of the score computation for the named document.
Optional method that delegates to scorerSupplier.
Get a ScorerSupplier, which allows knowing the cost of the Scorer before building it. A scorer supplier for the same LeafReaderContext instance may be requested multiple times as part of a single search call.