Section navigation

Public struct 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

Public constructor TopNCollector(ScoreDoc[], int)

Constructs a collector using an externally-owned backing array (avoids allocation).

Public constructor TopNCollector(int)

Initialises a new TopNCollector with the specified capacity.

Public property Capacity

Gets the maximum number of documents this collector can retain.

Public property IsFull

True when the collector has reached its maximum capacity.

Public property MinScore

Gets the score of the lowest-ranked document currently in the top-N, or NegativeInfinity if fewer than N documents have been collected.

Public property TotalHits

Gets the total number of documents passed to Collect(int, float).

Public method Collect(int, float)

Collects a matching document and its score, keeping only the top-N by score.

Public method Reset()

Resets state for reuse, keeping the backing array.

Public method ToTopDocs()

Materialises the collected results as a TopDocs sorted by score descending.