C# Class Lucene.Net.Index.Sorter.EarlyTerminatingSortingCollector

A Collector that early terminates collection of documents on a per-segment basis, if the segment was sorted according to the given Sort.

NOTE: the Collector detects sorted segments according to SortingMergePolicy, so it's best used in conjunction with it. Also, it collects up to a specified numDocsToCollect from each segment, and therefore is mostly suitable for use in conjunction with collectors such as Search.TopDocsCollector{T}, and not e.g. TotalHitCountCollector.

NOTE: If you wrap a Search.TopDocsCollector{T} that sorts in the same order as the index order, the returned TopDocs will be correct. However the total of TopDocsCollector{T}.TotalHits hit count will be underestimated since not all matching documents will have been collected.

NOTE: This Collector uses Sort.ToString() to detect whether a segment was sorted with the same Sort. This has two implications:

  • if a custom comparator 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 Collector will incorrectly detect sorted segments.
@lucene.experimental

Inheritance: Lucene.Net.Search.Collector
显示文件 Open project: apache/lucenenet Class Usage Examples

Protected Properties

Property Type Description
@in Lucene.Net.Search.Collector
numDocsToCollect int
segmentSorted bool
segmentTotalCollect int
sort Lucene.Net.Search.Sort

Public Methods

Method Description
AcceptsDocsOutOfOrder ( ) : bool
Collect ( int doc ) : void
EarlyTerminatingSortingCollector ( Collector @in, Lucene.Net.Search.Sort sort, int numDocsToCollect ) : Lucene.Net.Search

Create a new EarlyTerminatingSortingCollector instance.

Method Details

AcceptsDocsOutOfOrder() public method

public AcceptsDocsOutOfOrder ( ) : bool
return bool

Collect() public method

public Collect ( int doc ) : void
doc int
return void

EarlyTerminatingSortingCollector() public method

Create a new EarlyTerminatingSortingCollector instance.
public EarlyTerminatingSortingCollector ( Collector @in, Lucene.Net.Search.Sort sort, int numDocsToCollect ) : Lucene.Net.Search
@in Lucene.Net.Search.Collector
sort Lucene.Net.Search.Sort /// the sort you are sorting the search results on
numDocsToCollect int /// the number of documents to collect on each segment. When wrapping /// a , this number should be the number of /// hits.
return Lucene.Net.Search

Property Details

@in protected_oe property

The wrapped Collector
protected Collector,Lucene.Net.Search @in
return Lucene.Net.Search.Collector

numDocsToCollect protected_oe property

Number of documents to collect in each segment
protected int numDocsToCollect
return int

segmentSorted protected_oe property

True if the current segment being processed is sorted by Sort()
protected bool segmentSorted
return bool

segmentTotalCollect protected_oe property

Number of documents to collect in the current segment being processed
protected int segmentTotalCollect
return int

sort protected_oe property

Sort used to sort the search results
protected Sort,Lucene.Net.Search sort
return Lucene.Net.Search.Sort