Method ReadRankedCandidatesAsync
- Namespace
- MailFathom.Application.Emails.Search
- Assembly
- MailFathom.Application.dll
ReadRankedCandidatesAsync(MailboxEmailSelection, EmailSearchQueryText, int, CancellationToken)
Ranks the emails matching a query, among those the structured filters select.
Task<IReadOnlyList<RankedEmailCandidate>> ReadRankedCandidatesAsync(MailboxEmailSelection selection, EmailSearchQueryText queryText, int limit, CancellationToken cancellationToken)
Parameters
selectionMailboxEmailSelectionWhich emails are eligible before the text is considered.
queryTextEmailSearchQueryTextThe validated free text to match against the index.
limitintThe greatest number of ranked candidates to return, at least one.
cancellationTokenCancellationTokenPropagates caller cancellation.
Returns
- Task<IReadOnlyList<RankedEmailCandidate>>
At most
limitcandidates, most relevant first, empty when nothing matched.
Remarks
The order is deterministic. Full-text rank alone produces ties — several messages carrying one uncommon word score identically — so an implementation orders by rank descending and then by EmailTimelinePosition in its newest-first direction, which is total. Two identical requests over an unchanged index therefore return the same sequence.
Matching nothing is an empty result rather than a failure. A search that reported the difference between "no such mail" and "no such folder" would answer questions about accounts and folders the caller was never told about.
Exceptions
- ArgumentNullException
Thrown when
selectionorqueryTextis null.- ArgumentOutOfRangeException
Thrown when
limitis below one.