fix(docs): disable fuzzy matching in docs search (exact word or prefix only) - #65103
Merged
Conversation
…x only) 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.
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…x only) (NousResearch#65103) 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.
10 tasks
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
…x only) (NousResearch#65103) 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Docs search now matches the exact word or its extension only (
keet→keet*) — fuzzy edit-distance matching is disabled, which also removes the query explosion that could stall the search worker until the bar appeared dead.Root cause:
@easyops-cn/docusaurus-search-localdefaultsfuzzyMatchingDistance: 1, so every term also matched words one edit away.Fixes two community reports:
keetreturned "Microsoft Teams Meetings", "google_meet", "Keep the Model Loaded":meetandkeepare one edit fromkeet, and the stemmer indexes "meetings" as "meet".REQUIREDterms are the expensive scan kind against our 14.4 MB index. Reproduced live on the production docs: a typo'd 3-word query stalled the single-threaded search Web Worker 25+ seconds, and every later keystroke's search queued behind it.Changes
website/docusaurus.config.ts: setfuzzyMatchingDistance: 0on the search-local theme, with a comment documenting why.Validation
Ran the plugin's shipped
smartQueries/tokenizecode (v0.55.1 dist, unmodified) against the downloaded productionsearch-index.json:keetcron,telegrammemor(prefix typing)Also verified
npx docusaurus buildpasses and the generated client constant isfuzzyMatchingDistance = 0.Infographic