Table of Contents

Class RunSearchTokenizer

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

Tokenizer for the portable run-search token index (FlowRunSearchTokens): turns run, step and payload text into lower-cased identifier tokens, and a search term into the tokens to probe.

public static class RunSearchTokenizer
Inheritance
RunSearchTokenizer
Inherited Members

Remarks

A token is a run of letters, digits and the identifier joiners - _ . @ :, so ORD-2026-0001234 and jane@example.com stay one token. The joiner-separated parts are emitted too (ord, 2026, 0001234), and for names the camelCase humps (InvoiceSyncFlow → invoice, sync, flow), so a fragment is still a token prefix.

From JSON only scalar string values without whitespace are indexed — ids, codes, emails, statuses — and array elements are skipped. Prose inside values is deliberately not indexed: that is a full-text engine's job, which an IRunSearchIndex implementation can plug in.

Cost: O(length of the input) per document, one string per distinct token. It runs on the step completion path only when the token index is enabled.

Fields

DefaultMaxTokensPerDocument

Default cap on distinct tokens taken from one document.

public const int DefaultMaxTokensPerDocument = 256

Field Value

int

MaxTokenLength

Longest indexed token; longer composites are dropped, their parts are still indexed.

public const int MaxTokenLength = 64

Field Value

int

MinTokenLength

Shortest indexed token.

public const int MinTokenLength = 2

Field Value

int

Methods

AddJsonValues(string?, HashSet<string>, int)

Adds the single-token scalar string values of a JSON document to sink. Invalid JSON adds nothing and never throws.

public static void AddJsonValues(string? json, HashSet<string> sink, int maxTokens = 256)

Parameters

json string

The JSON text.

sink HashSet<string>

Receives lower-cased tokens. Use an ordinal comparer.

maxTokens int

Stops once sink holds this many tokens.

AddText(ReadOnlySpan<char>, HashSet<string>, bool, int)

Adds the tokens of free text (names, keys, error messages) to sink.

public static void AddText(ReadOnlySpan<char> text, HashSet<string> sink, bool camelCase = false, int maxTokens = 256)

Parameters

text ReadOnlySpan<char>

The text; null or empty adds nothing.

sink HashSet<string>

Receives lower-cased tokens. Use an ordinal comparer.

camelCase bool

Also split camelCase humps (for flow names and step keys).

maxTokens int

Stops once sink holds this many tokens.

QueryTokens(ReadOnlySpan<char>, int)

Returns the tokens of a user search term, longest first (the most selective probe leads). A search matches runs that have a token starting with every returned query token.

public static IReadOnlyList<string> QueryTokens(ReadOnlySpan<char> term, int maxTokens = 4)

Parameters

term ReadOnlySpan<char>

The search term.

maxTokens int

The longest maxTokens tokens are returned; the rest are dropped, which widens the match.

Returns

IReadOnlyList<string>

Distinct lower-cased tokens; empty when the term has no token of MinTokenLength characters.