Table of Contents

Class RunSearchQuery

Namespace
FlowOrchestrator.Core.Storage
Assembly
FlowOrchestrator.Core.dll

Structured run-list query for SearchRunsAsync(RunSearchQuery, CancellationToken). Every filter is AND-combined; unset filters are ignored.

public sealed record RunSearchQuery : IEquatable<RunSearchQuery>
Inheritance
RunSearchQuery
Implements
Inherited Members

Remarks

The query is deliberately structured rather than a single free-text string: deciding that a term is a run id or a status name happens once, in the caller, so every provider gets the same index seeks instead of a substring scan. Providers must not reinterpret Text as a status; the only id handling of Text is the documented equality and prefix match.

Fields

MinRunIdPrefixLength

Shortest term treated as a run-id prefix; shorter hex strings match too many ids to be useful.

public const int MinRunIdPrefixLength = 4

Field Value

int

Properties

After

Keyset cursor: return only rows that sort after this position (the NextCursor of the previous page). null starts at the newest run.

public RunSearchCursor? After { get; init; }

Property Value

RunSearchCursor?

CountsTotal

true when the store should compute TotalCount.

public bool CountsTotal { get; }

Property Value

bool

EffectiveTotalCountCap

TotalCountCap when it is a usable positive cap; otherwise null (exact count).

public int? EffectiveTotalCountCap { get; }

Property Value

int?

FlowId

Restricts results to a single flow.

public Guid? FlowId { get; init; }

Property Value

Guid?

HasText

true when Text carries a non-blank term.

public bool HasText { get; }

Property Value

bool

IncludeStepPayloads

When true, Text is also matched against the run's current step rows (step key, error message, output JSON). Off by default: it reads every step payload in the window, so callers should only set it together with a bounded StartedFrom.

public bool IncludeStepPayloads { get; init; }

Property Value

bool

IncludeTotal

Requests an exact TotalCount. Honoured only when neither Text nor RunId is set, so the count stays an index-only count over the plain filters; a text search reports HasMore instead.

public bool IncludeTotal { get; init; }

Property Value

bool

RunId

Exact run-id match. Providers compare the key column by equality, which is a primary-key seek; never a cast-and-substring match.

public Guid? RunId { get; init; }

Property Value

Guid?

Skip

Number of leading rows to skip (offset pagination, newest first).

public int Skip { get; init; }

Property Value

int

Remarks

Kept for compatibility and for jumping to an arbitrary page. An offset re-reads every skipped row (page 2,000 of 200k runs on SQL Server: 189 ms, against 32 ms with After), and the page shifts when new runs start in between. Prefer After for next-page navigation. When both are set, Skip counts rows after the cursor.

StartedFrom

Inclusive lower bound on the run's start time.

public DateTimeOffset? StartedFrom { get; init; }

Property Value

DateTimeOffset?

StartedTo

Inclusive upper bound on the run's start time.

public DateTimeOffset? StartedTo { get; init; }

Property Value

DateTimeOffset?

Status

Restricts results to runs whose status equals this canonical token (e.g. "Succeeded").

public string? Status { get; init; }

Property Value

string

Take

Maximum number of rows to return.

public int Take { get; init; }

Property Value

int

Text

Case-insensitive substring matched against the run's own columns: id, flow name, trigger key, status and background job id. When the text parses as a GUID the id column is compared by equality instead of a substring match.

public string? Text { get; init; }

Property Value

string

Remarks

On the built-in providers (SQL Server, PostgreSQL, in-memory), a term that looks like the start of a run id (see IsRunIdPrefix(ReadOnlySpan<char>), e.g. the eight characters the dashboard's run list shows) additionally matches every run whose id starts with it, regardless of StartedFrom / StartedTo: an id prefix is an index seek, so an old run is found without widening the window. Third-party providers going through the default implementation match it inside the window.

Case folding is ordinal (ToLowerInvariant on both sides). The SQL Server provider compares binary after lower-casing, so it is accent- and width-sensitive: é does not match e and ß does not match ss, unlike the database's linguistic CI_AS collation. Identifiers, codes and ASCII text match exactly as before.

TotalCountCap

Upper bound for the IncludeTotal count. When greater than zero the store counts at most TotalCountCap + 1 rows; if more match, TotalCount is TotalCountCap and TotalIsLowerBound is true (render it as "10,000+"). null or non-positive counts exactly.

public int? TotalCountCap { get; init; }

Property Value

int?

Remarks

An exact COUNT(*) grows linearly with retention (10.7 ms of an 11.9 ms page at 200k runs on SQL Server); the capped count stops after the cap (1.1 ms) and is enough for page navigation.

Methods

IsRunIdPrefix(ReadOnlySpan<char>)

Returns true when text can be the start of a run id in its canonical D form: MinRunIdPrefixLength to 35 characters, hex digits and hyphens only, at least one hex digit. A full 36-character id is an equality match instead.

public static bool IsRunIdPrefix(ReadOnlySpan<char> text)

Parameters

text ReadOnlySpan<char>

The trimmed search term.

Returns

bool

Whether providers should also run the id-prefix match for this term.