TopNCollector
- Namespace
- Rowles.LeanCorpus.Search.Scoring
- Assembly
- Rowles.LeanCorpus.dll
Bounded min-heap collector that keeps the top-N highest-scoring documents. Single allocation: the ScoreDoc[topN] backing array.
public struct TopNCollector
TopNCollector(ScoreDoc[], int)
Constructs a collector using an externally-owned backing array (avoids allocation).
TopNCollector(int)
Initialises a new TopNCollector with the specified capacity.
Capacity
Gets the maximum number of documents this collector can retain.
IsFull
True when the collector has reached its maximum capacity.
MinScore
Gets the score of the lowest-ranked document currently in the top-N, or NegativeInfinity if fewer than N documents have been collected.
TotalHits
Gets the total number of documents passed to Collect(int, float).
Collect(int, float)
Collects a matching document and its score, keeping only the top-N by score.
Reset()
Resets state for reuse, keeping the backing array.
ToTopDocs()
Materialises the collected results as a TopDocs sorted by score descending.