Skip to content

fix(search): rank English term boundaries and guide direct API searches - #154

Open
humandebri wants to merge 1 commit into
mainfrom
fix/english-search-ranking
Open

humandebri wants to merge 1 commit into
mainfrom
fix/english-search-ranking

Conversation

@humandebri

Copy link
Copy Markdown
Collaborator

Purpose

SSE receives strong title/path scores inside unrelated words such as precompressed and WebAssembly, displacing relevant body evidence. Direct ICP callers also need guidance for turning English questions into useful existing API searches.

Changes

  • Require case-insensitive ASCII word, camelCase or acronym boundaries for strong title/path boosts; keep dotted identifiers intact.
  • Retain incidental substring candidates at weak existing path scores, including when FTS title weighting would otherwise promote them. Preserve exact-path/basename/prefix priorities, non-ASCII matching, short-term rules, candidate queries, caps and score constants.
  • Add English keyword-search guidance to the existing shared JSON rendered by get_api_doc: up to three focused searches, scoped candidates, deduplication and body verification. MCP search code and tool descriptors are unchanged.
  • Reuse the existing 1,154-document / 46-case MCP fixture in real store tests, with search/retrieval hit parity and per-case English recall guards.

Verification

  • Confirmed the 32-distractor SSE regression fails before the fix and passes after it.
  • Paired real-store replay: English positive hit@20 remains 34/35, with no previously successful English case lost. Bare sse finds the timeout gold at rank 4, previously outside the top 20. The six documented keyword examples find gold at ranks 1 / 1 / 3 / 6 / 2 / 1; original labels are unchanged.
  • Rust store/canister suites, MCP Node/Vitest/workerd suites, shared-core tests, typecheck, generated Candid consistency, formatting and diff checks passed. Canister build and MCP dry-run build passed.
  • Existing recorded MCP/Jev replay also passes (holdout hit@10 19/20); this frozen-response replay is separate from the changed-store measurements above.
  • Independent review found no blocking issues. Added individual-case recall and short-term/Unicode boundary checks from review.

Impact

Ranking affects existing MCP, CLI, browser and direct ICP callers. Relevant bodies with incidental filenames can also receive weaker scores; frozen-corpus hit@20 is preserved, while the original general-SSE question changes from rank 1 to 3. Natural-language parsing and Japanese short-word handling are unchanged.

No public API/Candid/authentication/authorization/billing/schema changes, Worker changes or new operational document. No deployment performed. Live ICP/CLI comparison requires a separate canister upgrade; no Worker deployment is needed.

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.

1 participant