CommandSearchResult

Record type representing a single fuzzy search result from CommandSearch. Wraps the matched CommandMethod along with the match score and a per-character match table that enables rich text highlighting of matched characters in the UI. Implements IComparable<CommandSearchResult> for score-based sorting (highest score first).

Definition

Namespace: Paragon.Core.Command Assembly: Paragon.dll

public record CommandSearchResult : IComparable<CommandSearchResult>

Implements: IComparable<CommandSearchResult>

Remarks

CommandSearchResult is a C# record, providing value-based equality. Results are created by CommandSearch.GetAllMatchingName() and consumed by the CommandToolbar to render highlighted search results and by the Command.Search() facade.

The matchTable is a bool[] with one entry per character in the command name. true at index i means that character was part of the fuzzy match. This enables per-character highlighting in the toolbar UI (matched characters are rendered in gold).

Quick Lookup

Goal
How

Get the matched command

result.Command

Get the command name

result.Name

Check for exact match

result.IsExactMatch()

Check if character N matched

result.IsMatchAtIndex(n)

Sort results

Built-in via IComparable (descending score)

Properties

Command

The matched CommandMethod instance.

Name

Convenience accessor for Command.Name.

Constructor

CommandSearchResult(CommandMethod, string, int, bool[])

Creates a search result with all match metadata.

Parameter
Type
Description

commandMethod

CommandMethod

The matched command

inputName

string

The user's input that produced this match

matchScore

int

The weighted match score (higher = better)

matchTable

bool[]

Per-character match flags (length = command name length)

Methods

IsExactMatch

Returns true if every character in the command name was matched (i.e., the input fully covers the command name).

Returns: true if all entries in matchTable are true.

IsMatchAtIndex

Returns whether the character at the given index in the command name was part of the fuzzy match. Used by the toolbar to determine which characters to highlight.

Parameter
Type
Description

index

int

Character index in the command name

Returns: true if the character at that position matched.

CompareTo

Compares by descending match score (higher scores sort first).

Parameter
Type
Description

other

CommandSearchResult

The result to compare against

Returns: Negative if this result has a higher score, positive if lower, zero if equal.

Examples

Inspecting Match Results

See Also

Last updated