Skip to content

feat(plugin-search): add optional fuzzy matching to findSearchMatches#138

Closed
rizgan wants to merge 1 commit into
floatboatai:mainfrom
rizgan:feat/plugin-search-fuzzy
Closed

feat(plugin-search): add optional fuzzy matching to findSearchMatches#138
rizgan wants to merge 1 commit into
floatboatai:mainfrom
rizgan:feat/plugin-search-fuzzy

Conversation

@rizgan

@rizgan rizgan commented Jul 7, 2026

Copy link
Copy Markdown

What

Adds an opt-in fuzzy option to findSearchMatches in @floatboat/nexus-plugin-search.
Implements roadmap item #17 (Fuzzy search, P2).

When { fuzzy: true } is passed, each line is matched as a subsequence of
the query and annotated with a relevance score, so callers can rank results.

Why

Exact and regex search require the query to appear contiguously. Fuzzy
matching lets users find lines by typing a loose, ordered subset of the
characters — the same interaction model as a command palette / file finder.

Design

  • Per-line matching. Each line is treated as a candidate, so a match's
    from/to stays bounded to a single line instead of spanning the whole
    document.
  • Greedy left-most subsequence with a small scoring function
    (contiguous runs, word-start hits, and a leading match are rewarded; gaps
    are penalized). Scoring style mirrors the existing slash-state.ts ranking.
  • Query characters are always literal (never regex) in fuzzy mode.
  • Results stay in document order; sorting by score is left to the caller.

Scope / non-goals

  • Purely additive and opt-in — default, regex, whole-word, and case-sensitive
    behavior are unchanged.
  • replaceAllMatches, the CM6 search panel, and search history are untouched.
  • No new dependencies.

Tests

Added 8 unit tests (fuzzy vs exact, out-of-order rejection, document order,
case sensitivity, literal-not-regex, empty query, score ranking, and "no
score on exact matches"). Full suite: 37/37 passing; package typecheck clean.

@CLAassistant

CLAassistant commented Jul 7, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rizgan rizgan closed this by deleting the head repository Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants