FindMyFiles

FindMyFiles.ViewModels

SearchOrchestrator Class

When and what to search: 50ms debounce on typing (clearing is instant), a generation counter that discards superseded responses, requery triggers (index changes, stale results) and exception classification. Results are handed to the ResultsPresenter; failures surface through SearchFailed so the ViewModel owns the user-facing wording. All entry points run on the UI thread.

public sealed class SearchOrchestrator

Inheritance System.Object → SearchOrchestrator

Constructors

SearchOrchestrator(IEngineClient, EngineEventMarshaler, IDispatcher, ResultsPresenter, Func<SearchRequest>) Constructor

Wires the orchestrator to its collaborators and subscribes the auto-requery triggers (stale results, index changes).

public SearchOrchestrator(FindMyFiles.Engine.IEngineClient engine, FindMyFiles.Engine.EngineEventMarshaler engineEvents, FindMyFiles.Services.IDispatcher dispatcher, FindMyFiles.ViewModels.ResultsPresenter presenter, System.Func<FindMyFiles.ViewModels.SearchRequest> request);

Parameters

engine IEngineClient

Engine the queries are issued against.

engineEvents EngineEventMarshaler

UI-thread-marshaled engine events; its IndexChanged drives an automatic requery.

dispatcher IDispatcher

UI dispatcher — used to create the debounce timer.

presenter ResultsPresenter

Sink that publishes results and stale signals.

request System.Func<SearchRequest>

Pull of the current UI state at query time (the ViewModel stays the source of truth).

Properties

SearchOrchestrator.FocusedExcludePaths Property

Noise paths excluded in focused mode (settings-owned).

public System.Collections.Generic.IReadOnlyList<string> FocusedExcludePaths { get; set; }

Property Value

System.Collections.Generic.IReadOnlyList<System.String>

SearchOrchestrator.FocusedExtensions Property

Extension whitelist for focused mode (settings-owned).

public System.Collections.Generic.IReadOnlyList<string> FocusedExtensions { get; set; }

Property Value

System.Collections.Generic.IReadOnlyList<System.String>

SearchOrchestrator.FocusedSearch Property

Focused search: when on, the user's query is rewritten with the two lists below (FocusedQueryRewriter) right before it reaches the engine. Defaults to off here — product wiring (MainViewModel) pushes the persisted settings in; a toggle flip is a filter change, so the owner requeries with Filter (top reset).

public bool FocusedSearch { get; set; }

Property Value

System.Boolean

Methods

SearchOrchestrator.NotifyCompositionEnded(string) Method

IME composition committed (or cancelled) — search the final text through the normal debounce.

public void NotifyCompositionEnded(string value);

Parameters

value System.String

The committed search box text after composition.

SearchOrchestrator.NotifyCompositionStarted() Method

IME composition began: hold queries so half-composed text (romaji fragments, candidate strings) never hits the engine.

public void NotifyCompositionStarted();

SearchOrchestrator.NotifyTextChanged(string) Method

Search box text changed: debounce a normal edit (50ms), requery immediately on a clear (so emptying feels instant), and ignore edits while an IME composition is in flight.

public void NotifyTextChanged(string value);

Parameters

value System.String

The current search box text after the edit.

SearchOrchestrator.Requery(RequeryOrigin) Method

Fire-and-forget a query for the current UI state, bumping the generation so any in-flight older response is discarded. origin records why (and lets the presenter decide whether to preserve scroll/selection).

public void Requery(FindMyFiles.ViewModels.RequeryOrigin origin);

Parameters

origin RequeryOrigin

Why the requery was triggered.

Events

SearchOrchestrator.SearchFailed Event

Engine or unexpected failure (never query syntax — that goes to the presenter as count text).

public event Action<Exception>? SearchFailed;

Event Type

System.Action<System.Exception>

SearchOrchestrator.TraceCaptured Event

Stage trace of the last completed query (null when the engine produced none) — perf-panel food.

public event Action<QueryTraceData?>? TraceCaptured;

Event Type

System.Action<QueryTraceData>