
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
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.
CancellationToken
Cancellation token honoured between segments. Default: System.Threading.CancellationToken.None.
Default
Default options with no limits.
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.
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.
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.
WithBudget(long)
Creates options with a specific approximate result-byte budget.
WithBudgetAndTimeout(long, TimeSpan)
Creates options with both a deadline and a result-byte budget.
WithTimeout(TimeSpan)
Creates options with a specific wall-clock deadline.