Method ReadRankedMatchesAsync
- Namespace
- MailFathom.Application.Emails.Search
- Assembly
- MailFathom.Application.dll
ReadRankedMatchesAsync(MailboxEmailSelection, EmailSearchQueryText, EmailSearchSnippetBounds, int, CancellationToken)
Reads the highest-ranked emails matching a query, among those the structured filters select.
Task<IReadOnlyList<EmailSearchMatch>> ReadRankedMatchesAsync(MailboxEmailSelection selection, EmailSearchQueryText queryText, EmailSearchSnippetBounds snippetBounds, int limit, CancellationToken cancellationToken)
Parameters
selectionMailboxEmailSelectionWhich emails are eligible before the text is considered.
queryTextEmailSearchQueryTextThe validated free text to match against the index.
snippetBoundsEmailSearchSnippetBoundsHow many extracts one result may carry, and how long each may be.
limitintThe greatest number of ranked results to return, at least one.
cancellationTokenCancellationTokenPropagates caller cancellation.
Returns
- Task<IReadOnlyList<EmailSearchMatch>>
At most
limitmatches, 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
selection,queryText, orsnippetBoundsis null.- ArgumentOutOfRangeException
Thrown when
limitis below one.