Table of Contents

Public classSealed SearchOptions

Namespace
Rowles.LeanCorpus.Search
Assembly
Rowles.LeanCorpus.dll

Per-query options controlling resource usage and result delivery. Pass to IndexSearcher.Search(Query, int, SearchOptions) to limit memory and wall-clock time, or to IndexSearcher.SearchStreaming to receive results in segment order rather than fully collected.

public sealed class SearchOptions
SearchOptions

Remarks

Timeouts and cancellation are checked at segment boundaries. A query already inside a hot inner loop will complete that segment before the deadline is honoured. On early termination the returned IsPartial is set.

Public property CancellationToken

Cancellation token honoured between segments. Default: System.Threading.CancellationToken.None.

Public property Default

Default options with no limits.

Public property MaxResultBytes

Approximate budget on the bytes the retained result accumulator may hold. Each retained candidate costs roughly 12 bytes (one ScoreDoc). Regular top-N searches throw if the requested heap cannot fit within this budget. Streaming searches check the budget between segments and stop yielding when it is exhausted.

Public property StreamResults

When true, callers are expected to invoke IndexSearcher.SearchStreaming instead of Search. The streaming path yields per-segment results in segment order without building a global top-N heap. Default: false.

Public property Timeout

Wall-clock deadline for the query. Checked between segments. When exceeded, the search stops and returns a partial result with IsPartial set. Default: no limit.

Public method WithBudget(long)

Creates options with a specific approximate result-byte budget.

Public method WithBudgetAndTimeout(long, TimeSpan)

Creates options with both a deadline and a result-byte budget.

Public method WithTimeout(TimeSpan)

Creates options with a specific wall-clock deadline.