TopNCollector
- Namespace
- Rowles.LeanLucene.Search.Scoring
- Assembly
- Rowles.LeanLucene.dll
Bounded min-heap collector that keeps the top-N highest-scoring documents. Single allocation: the ScoreDoc[topN] backing array.
public struct TopNCollector
Constructors
TopNCollector(ScoreDoc[], int)
Constructs a collector using an externally-owned backing array (avoids allocation).
TopNCollector(int)
Initialises a new TopNCollector with the specified capacity.
Properties
Capacity
Gets the maximum number of documents this collector can retain.
Methods
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.