Class 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(ICollector)
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!
NOTE: this class caches at least 128 documents before checking RAM limits.
See the Lucene modules/grouping
module for more
details including a full code example.
@lucene.experimental
Inheritance
Assembly: DistributedLucene.Net.dll
Syntax
public abstract class CachingCollector : object, ICollector
Fields
Name | Description |
---|---|
m_base | |
m_cachedDocs | |
m_curDocs | |
m_lastDocBase | |
m_maxDocsToCache | |
m_other | |
m_upto |
Properties
Name | Description |
---|---|
AcceptsDocsOutOfOrder | |
IsCached |
Methods
Name | Description |
---|---|
Collect(Int32) | Called once for every document matching a query, with the unbased document number. Note: The collection of the current segment can be terminated by throwing a CollectionTerminatedException. In this case, the last docs of the current AtomicReaderContext will be skipped and IndexSearcher will swallow the exception and continue collection with the next leaf.
Note: this is called in an inner search loop. For good search performance,
implementations of this method should not call |
Create(ICollector, Boolean, Double) | Create a new CachingCollector that wraps the given collector and caches documents and scores up to the specified RAM threshold. |
Create(ICollector, Boolean, Int32) | Create a new CachingCollector that wraps the given collector and caches documents and scores up to the specified max docs threshold. |
Create(Boolean, Boolean, Double) | Creates a CachingCollector which does not wrap another collector. The cached documents and scores can later be replayed (Replay(ICollector)). |
Replay(ICollector) | Replays the cached doc IDs (and scores) to the given ICollector. If this
instance does not cache scores, then Scorer is not set on
|
SetNextReader(AtomicReaderContext) | |
SetScorer(Scorer) | Called before successive calls to Collect(Int32). Implementations
that need the score of the current document (passed-in to
|