Skip to content

fix(docs): disable fuzzy matching in docs search (exact word or prefix only) - #65103

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-cd006c5f
Jul 15, 2026
Merged

fix(docs): disable fuzzy matching in docs search (exact word or prefix only)#65103
teknium1 merged 1 commit into
mainfrom
hermes/hermes-cd006c5f

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Docs search now matches the exact word or its extension only (keetkeet*) — 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-local defaults fuzzyMatchingDistance: 1, so every term also matched words one edit away.

Fixes two community reports:

  1. Wrong results — searching keet returned "Microsoft Teams Meetings", "google_meet", "Keep the Model Loaded": meet and keep are one edit from keet, and the stemmer indexes "meetings" as "meet".
  2. Search stops functioning after a bit — fuzzy matching multiplies the generated lunr queries (distance matrix × maybe-typing variants × leave-one-out terms; up to 210 queries per keystroke on multi-word input) and fuzzy REQUIRED terms 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: set fuzzyMatchingDistance: 0 on the search-local theme, with a comment documenting why.

Validation

Ran the plugin's shipped smartQueries/tokenize code (v0.55.1 dist, unmodified) against the downloaded production search-index.json:

Query Before (distance 1) After (distance 0)
keet Teams Meetings / google_meet / Keep… (false hits) no false hits
cron, telegram correct identical results
memor (prefix typing) works still works
worst-case multi-word typo 210 queries, 365–532 ms per keystroke (25 s+ stall observed live) 50–105 queries, 53–188 ms

Also verified npx docusaurus build passes and the generated client constant is fuzzyMatchingDistance = 0.

Infographic

docs-search-exact-match

…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.
@alt-glitch alt-glitch added type/docs Documentation improvements P3 Low — cosmetic, nice to have labels Jul 15, 2026
@teknium1
teknium1 merged commit 2106f63 into main Jul 15, 2026
15 checks passed
@teknium1
teknium1 deleted the hermes/hermes-cd006c5f branch July 15, 2026 16:57
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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have type/docs Documentation improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants