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
Afficher le fichier Open project: apache/lucenenet Class Usage Examples

Protected Properties

Свойство Type Description
@in Lucene.Net.Search.Collector
numDocsToCollect int
segmentSorted bool
segmentTotalCollect int
sort Lucene.Net.Search.Sort

Méthodes publiques

Méthode 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 méthode

public AcceptsDocsOutOfOrder ( ) : bool
Résultat bool

Collect() public méthode

public Collect ( int doc ) : void
doc int
Résultat void

EarlyTerminatingSortingCollector() public méthode

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.
Résultat Lucene.Net.Search

Property Details

@in protected_oe property

The wrapped Collector
protected Collector,Lucene.Net.Search @in
Résultat Lucene.Net.Search.Collector

numDocsToCollect protected_oe property

Number of documents to collect in each segment
protected int numDocsToCollect
Résultat int

segmentSorted protected_oe property

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

segmentTotalCollect protected_oe property

Number of documents to collect in the current segment being processed
protected int segmentTotalCollect
Résultat int

sort protected_oe property

Sort used to sort the search results
protected Sort,Lucene.Net.Search sort
Résultat Lucene.Net.Search.Sort