Table of Contents

Struct RankedSearchCursor

Namespace
MailFathom.Application.Emails.BrowseSearch
Assembly
MailFathom.Application.dll

Marks where one page of a ranked search ended, so the next page continues from it.

public readonly record struct RankedSearchCursor : IEquatable<RankedSearchCursor>
Implements
Inherited Members

Remarks

The cursor pairs the place the last returned result held — its score and its timeline position, which together are the total order a ranked list publishes — with the fingerprint of the list it was issued for. The next page reads the results ordered strictly after that place, so the boundary is a key rather than a count and a client never asks for "the results after the first forty".

What a ranked boundary cannot promise is what a timeline's promises. A timeline orders by an instant nothing recomputes, so a cursor into one can neither skip a row nor repeat one; relevance is recomputed per query, so a message indexed between two pages can move across a boundary a client is holding and be seen twice or not at all. That is the honest cost of paging a ranking, and it is bounded rather than open: the order is total, so a continuation always advances, and MaximumRankedDepth is where every walk ends.

It carries no secret and needs no signature, for the reason every cursor here does not: every value in it is one the caller already received. Encoding is about opacity — a client that cannot read a cursor does not build one, and a built cursor is how a caller would ask for a boundary this system never computed.

The encoded form is this reading's own rather than KeysetCursorPayload's, as ContactCursor's is. That payload carries an instant, an identity, and a fingerprint, and a ranked boundary needs a fourth field those readings have no use for; widening the shared format so one reading could carry a score would retire every cursor of the other six to add a field none of them writes.

Properties

Boundary

Gets the boundary as the ranking itself expresses it, which is what a continuation compares against.

FilterFingerprint

Gets the fingerprint of the list this cursor was issued for.

Position

Gets the timeline position of that result, which is what settles a tie between two equal scores.

Score

Gets the score the last returned result held, in the units of the ranking that produced it.

Methods

After(RankedEmailCandidate, string)

Creates the cursor that continues a ranked walk after one result.

Encode()

Writes the cursor as the opaque string a caller presents to continue the walk.

TryDecode(string?, out RankedSearchCursor)

Reads a cursor a caller presented.