Skip to content

Search Match Engine

Search runs entirely on the client against the Dexie cache, so it works offline (Product Brief §1.1). The engine lives in src/lib/search/.

  • normalize.tsfold(s) normalizes text (case/diacritics) for accent-insensitive matching; isMatchable(query) gates whether a query is searchable (e.g. non-empty after folding).
  • match.tsmatch(...) produces a MatchOutcome over the match fields MatchField = 'title' | 'notes' | 'step', with MatchOptions/SearchResult types.
  • search.tssearch(...) is the top-level entry that runs the matcher across the cached Task set (title, notes, and child Step titles) and returns ranked SearchResults.
  • snippet.tssnippet(text, query, max = 80) builds a highlighted excerpt around the match for result display.

Search spans the Tasks a user can see (owned + member Lists), matching across a Task’s title, its notes, and its Steps’ titles. Because it reads the local cache, results are instant and available offline; there is no server search endpoint on the hot path.

Related: Offline Outbox & Optimistic Writes (the cache it searches), Create-Form & Search Triggers (UI entry, deferred guide).