Table of Contents

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

selection MailboxEmailSelection

Which emails are eligible before the text is considered.

queryText EmailSearchQueryText

The validated free text to match against the index.

snippetBounds EmailSearchSnippetBounds

How many extracts one result may carry, and how long each may be.

limit int

The greatest number of ranked results to return, at least one.

cancellationToken CancellationToken

Propagates caller cancellation.

Returns

Task<IReadOnlyList<EmailSearchMatch>>

At most limit matches, 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, or snippetBounds is null.

ArgumentOutOfRangeException

Thrown when limit is below one.