Table of Contents

Interface IEmailVectorSearchIndexReader

Namespace
MailFathom.Application.Emails.Search
Assembly
MailFathom.Application.dll

Ranks locally stored emails by how near their passages sit to a point in one vector space.

public interface IEmailVectorSearchIndexReader

Remarks

A separate port from IEmailSearchIndexReader because it reads a different table under a different order: vectors hang on passages, and a message's place is decided by its nearest passage rather than by anything the message itself holds. Folding both into one port would give an implementation two unrelated queries and a caller no way to serve one of them and not the other, which is exactly the deployment an instance with no embedding provider is.

The profile is a parameter rather than something the implementation reads for itself, because a vector means nothing outside the space it belongs to: the caller has already established that the query vector and the stored vectors were produced under one profile, and passing it is what carries that established fact into the query. See ADR 0006.

The structured filters narrow the eligible messages before distance is measured, never after. Ranking first and filtering afterwards would return fewer results than asked for whenever the caller's scope is narrow, and would measure a query against mail the caller may not see in order to decide the order of mail they may.

Methods

ReadNearestCandidatesAsync(MailboxEmailSelection, RegisteredEmbeddingProfile, EmbeddingVector, int, CancellationToken)

Reads the emails whose nearest passage sits closest to a query vector, among those the filters select.