C# Класс Lucene.Net.Search.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(Collector) 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
Наследование: Collector
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
@base int
CachedDocs IList
CurDocs int[]
LastDocBase int
MaxDocsToCache int
Other Collector
Upto int

Открытые методы

Метод Описание
AcceptsDocsOutOfOrder ( ) : bool
Create ( Collector other, bool cacheScores, double maxRAMMB ) : CachingCollector

Create a new CachingCollector that wraps the given collector and caches documents and scores up to the specified RAM threshold.

Create ( Collector other, bool cacheScores, int maxDocsToCache ) : CachingCollector

Create a new CachingCollector that wraps the given collector and caches documents and scores up to the specified max docs threshold.

Create ( bool acceptDocsOutOfOrder, bool cacheScores, double maxRAMMB ) : CachingCollector

Creates a CachingCollector which does not wrap another collector. The cached documents and scores can later be {@link #replay(Collector) replayed}.

Replay ( Collector other ) : void

Replays the cached doc IDs (and scores) to the given Collector. If this instance does not cache scores, then Scorer is not set on {@code other.setScorer} as well as scores are not replayed.

Приватные методы

Метод Описание
CachingCollector ( Collector other, double maxRAMMB, bool cacheScores ) : System.Collections.Generic
CachingCollector ( Collector other, int maxDocsToCache ) : System.Collections.Generic
ReplayInit ( Collector other ) : void

Reused by the specialized inner classes.

Описание методов

AcceptsDocsOutOfOrder() публичный Метод

public AcceptsDocsOutOfOrder ( ) : bool
Результат bool

Create() публичный статический Метод

Create a new CachingCollector that wraps the given collector and caches documents and scores up to the specified RAM threshold.
public static Create ( Collector other, bool cacheScores, double maxRAMMB ) : CachingCollector
other Collector /// the Collector to wrap and delegate calls to.
cacheScores bool /// whether to cache scores in addition to document IDs. Note that /// this increases the RAM consumed per doc
maxRAMMB double /// the maximum RAM in MB to consume for caching the documents and /// scores. If the collector exceeds the threshold, no documents and /// scores are cached.
Результат CachingCollector

Create() публичный статический Метод

Create a new CachingCollector that wraps the given collector and caches documents and scores up to the specified max docs threshold.
public static Create ( Collector other, bool cacheScores, int maxDocsToCache ) : CachingCollector
other Collector /// the Collector to wrap and delegate calls to.
cacheScores bool /// whether to cache scores in addition to document IDs. Note that /// this increases the RAM consumed per doc
maxDocsToCache int /// the maximum number of documents for caching the documents and /// possible the scores. If the collector exceeds the threshold, /// no documents and scores are cached.
Результат CachingCollector

Create() публичный статический Метод

Creates a CachingCollector which does not wrap another collector. The cached documents and scores can later be {@link #replay(Collector) replayed}.
public static Create ( bool acceptDocsOutOfOrder, bool cacheScores, double maxRAMMB ) : CachingCollector
acceptDocsOutOfOrder bool /// whether documents are allowed to be collected out-of-order
cacheScores bool
maxRAMMB double
Результат CachingCollector

Replay() публичный абстрактный Метод

Replays the cached doc IDs (and scores) to the given Collector. If this instance does not cache scores, then Scorer is not set on {@code other.setScorer} as well as scores are not replayed.
/// if this collector is not cached (i.e., if the RAM limits were too /// low for the number of documents + scores to cache). /// if the given Collect's does not support out-of-order collection, /// while the collector passed to the ctor does.
public abstract Replay ( Collector other ) : void
other Collector
Результат void

Описание свойств

@base защищенное свойство

protected int @base
Результат int

CachedDocs защищенное свойство

protected IList CachedDocs
Результат IList

CurDocs защищенное свойство

protected int[] CurDocs
Результат int[]

LastDocBase защищенное свойство

protected int LastDocBase
Результат int

MaxDocsToCache защищенное свойство

protected int MaxDocsToCache
Результат int

Other защищенное свойство

protected Collector,Lucene.Net.Search Other
Результат Collector

Upto защищенное свойство

protected int Upto
Результат int