Interface IEmailSearchIndexReader
- Namespace
- MailFathom.Application.Emails.Search
- Assembly
- MailFathom.Application.dll
Ranks locally stored emails against free text, and reads the window a ranking selected.
public interface IEmailSearchIndexReader
Remarks
The port is read-only and joins no transaction, per ADR 0001: it takes no persistence session, because a read has nothing to participate in.
It is separate from IStoredEmailTimelineReader because it reads a different table for a different order. The timeline reads mail metadata in a keyset order over a total ordering; this reads the derived search documents in relevance order, which has no total ordering of its own and no cursor into it.
Ranking and reading are two operations rather than one because a hybrid search ranks twice and reads once. Cutting snippets is the expensive half — a pass over a message body per row — so it happens after the window is closed, for the results a caller actually receives rather than for every candidate a fusion considered and dropped. A lexical search pays exactly what it paid when it was one operation, because the projection was already a second query.
Two obligations belong to every implementation rather than to its callers. The query text reaches the database as a parameter and never as concatenated SQL, and the text search configuration is the deployment's validated setting rather than anything the request carried. Both are what keep a caller's operators and metacharacters data instead of syntax, and neither can be checked from the application side, which is why the assertion that proves them lives where the generated command is observable.
Methods
- ReadMatchesAsync(MailboxEmailSelection, EmailSearchQueryText, EmailSearchSnippetBounds, IReadOnlyList<RankedEmailCandidate>, CancellationToken)
Reads the summaries and snippets of an already ranked window, in the order it was ranked.
- ReadRankedCandidatesAsync(MailboxEmailSelection, EmailSearchQueryText, int, CancellationToken)
Ranks the emails matching a query, among those the structured filters select.