CachingCollector

Caches all docs, and optionally also scores, coming from a search, and is then able to replay them to another collector. You specify the max RAM this class may use. Once the collection is done, call isCached. If this returns true, you can use replay against a new collector. If it returns false, this means too much RAM was required and you must instead re-run the original search.

NOTE: this class consumes 4 (or 8 bytes, if scoring is cached) per collected document. If the result set is large this can easily be a very substantial amount of RAM!

See the Lucene `modules/grouping` module for more details including a full code example.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override var weight: Weight?

Set the Weight that will be used to produce scorers that will feed [ ]s. This is typically useful to have access to Weight.count from .

Functions

Link copied to clipboard
open override fun getLeafCollector(context: LeafReaderContext): LeafCollector

Create a new collector to collect the given context.

Link copied to clipboard

Return true is this collector is able to replay collection.

Link copied to clipboard
abstract fun replay(other: Collector)
Link copied to clipboard
open override fun scoreMode(): ScoreMode

Indicates what features are required from the scorer.

Link copied to clipboard
fun set(weight: Weight)
Link copied to clipboard
open override fun toString(): String