Class EarlyTerminatingSortingCollector
A ICollector that early terminates collection of documents on a per-segment basis, if the segment was sorted according to the given Sort.
NOTE: the ICollector detects sorted segments according to SortingMergePolicy, so it's best used in conjunction with it. Also, it collects up to a specified m_numDocsToCollect from each segment, and therefore is mostly suitable for use in conjunction with collectors such as TopDocsCollector<T>, and not e.g. TotalHitCountCollector.
NOTE: If you wrap a TopDocsCollector<T> that sorts in the same order as the index order, the returned GetTopDocs() will be correct. However the total of TotalHits hit count will be underestimated since not all matching documents will have been collected.
NOTE: This ICollector uses ToString() to detect whether a segment was sorted with the same Sort. This has two implications:
- if a custom comparer is not implemented correctly and returns different identifiers for equivalent instances, this collector will not detect sorted segments,
- if you suddenly change the IndexWriter's SortingMergePolicy to sort according to another criterion and if both the old and the new Sorts have the same identifier, this ICollector will incorrectly detect sorted segments.
Inheritance
Assembly: Lucene.Net.Misc.dll
Syntax
public class EarlyTerminatingSortingCollector : object, ICollector
Constructors
Name | Description |
---|---|
EarlyTerminatingSortingCollector(ICollector, Sort, Int32) | Create a new EarlyTerminatingSortingCollector instance. |
Fields
Name | Description |
---|---|
m_in | The wrapped Collector |
m_numDocsToCollect | Number of documents to collect in each segment |
m_segmentSorted | True if the current segment being processed is sorted by Sort() |
m_segmentTotalCollect | Number of documents to collect in the current segment being processed |
m_sort | Sort used to sort the search results |
Properties
Name | Description |
---|---|
AcceptsDocsOutOfOrder |
Methods
Name | Description |
---|---|
Collect(Int32) | |
SetNextReader(AtomicReaderContext) | |
SetScorer(Scorer) |