Method ReadMatchesAsync
- Namespace
- MailFathom.Application.Emails.Search
- Assembly
- MailFathom.Application.dll
ReadMatchesAsync(MailboxEmailSelection, EmailSearchQueryText, EmailSearchSnippetBounds, IReadOnlyList<RankedEmailCandidate>, CancellationToken)
Reads the summaries and snippets of an already ranked window, in the order it was ranked.
Task<IReadOnlyList<EmailSearchMatch>> ReadMatchesAsync(MailboxEmailSelection selection, EmailSearchQueryText queryText, EmailSearchSnippetBounds snippetBounds, IReadOnlyList<RankedEmailCandidate> rankedCandidates, CancellationToken cancellationToken)
Parameters
selectionMailboxEmailSelectionThe same filters the candidates were ranked under.
queryTextEmailSearchQueryTextThe validated free text the snippets are cut around.
snippetBoundsEmailSearchSnippetBoundsHow many extracts one result may carry, and how long each may be.
rankedCandidatesIReadOnlyList<RankedEmailCandidate>The window to read, best first, each carrying the score the result publishes.
cancellationTokenCancellationTokenPropagates caller cancellation.
Returns
- Task<IReadOnlyList<EmailSearchMatch>>
One match per candidate that is still eligible, in the candidates' order.
Remarks
The filters are re-applied rather than trusted from the ranking, because the two statements read different snapshots: a run committing between them can leave a message the ranking admitted outside the request's scope, or delete it outright. Such a candidate is absent from the result rather than published, so a window never contradicts the request that produced it.
Snippets are cut around queryText whether the candidate was ranked lexically or by
similarity. A semantically ranked message that carries none of the query's words therefore carries no snippets,
which is the honest answer: there is no extract of it that shows why it matched, and returning its opening words
would present the start of a body as though it were a match.
Exceptions
- ArgumentNullException
Thrown when any reference argument is null.