From 2106f637236cf8935a12289d54f108ef27a8a8c4 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Wed, 15 Jul 2026 09:57:46 -0700 Subject: [PATCH] fix(docs): disable fuzzy matching in docs search (exact word or prefix only) (#65103) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The docs search theme (@easyops-cn/docusaurus-search-local) defaults fuzzyMatchingDistance to 1, so every term also matched words one edit away. Two user-visible failures on the 14.4 MB production index: - Wrong results: 'keet' returned 'Microsoft Teams Meetings', 'google_meet', 'Keep the Model Loaded' etc. — 'meet' and 'keep' are both one edit from 'keet', and the stemmer indexes 'meetings' as 'meet'. - Search appearing to die: fuzzy matching multiplies the generated lunr queries (distance matrix x maybe-typing variants x leave-one-out terms — up to 210 queries per keystroke on multi-word input), and fuzzy REQUIRED terms are the expensive scan kind. A typo'd 3-word query stalled the single-threaded search Web Worker for 25+ seconds; every later keystroke's search queued behind it, so the bar stopped returning results. Setting fuzzyMatchingDistance: 0 keeps exact-word-or-prefix semantics (keet -> keet*), which is the behavior users asked for. Validated by running the plugin's shipped smartQueries/tokenize code against the downloaded production search-index.json: legitimate queries (cron, telegram, prefix 'memor') return identical results; worst-case typo queries drop from 210 queries / 365-532ms per keystroke to 50-105 / 53-188ms; false 'keet' matches gone. --- website/docusaurus.config.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/website/docusaurus.config.ts b/website/docusaurus.config.ts index 6243170a6b..1c85d7693a 100644 --- a/website/docusaurus.config.ts +++ b/website/docusaurus.config.ts @@ -62,6 +62,14 @@ const config: Config = { /^user-guide\/skills\/bundled\//, /^user-guide\/skills\/optional\//, ], + // Exact-or-prefix matching only (default is edit distance 1). + // With fuzzy distance 1, "keet" matched "meetings"/"keep" (one + // edit away after stemming), and multi-word typo queries against + // our ~14 MB index could stall the single-threaded search worker + // for 25s+, backing up every subsequent keystroke's search until + // the bar appeared dead. Distance 0 keeps "word or its extension" + // semantics (keet -> keet*) and removes the pathological scans. + fuzzyMatchingDistance: 0, }), ], ],