Skip to content

Docs search ignores letter case, so search_docs("Mcp") finds the "Agents over MCP" sections instead of nothing - #1432

Open
rudycelekli wants to merge 1 commit into
deeplethe:devfrom
rudycelekli:docs-search-letter-case
Open

rudycelekli wants to merge 1 commit into
deeplethe:devfrom
rudycelekli:docs-search-letter-case

Conversation

@rudycelekli

Copy link
Copy Markdown
Contributor

Why

The search_docs tool (in chat and over MCP) searches the built-in Charter docs through DocsIndex. That index tokenizes with jieba alone, which keeps the original letter case, so a query term only matches if its case matches the markdown. The corpus is English (ingest.md, mcp.md), and the model writes queries in whatever case it likes. So search_docs("Mcp") or search_docs("settings") returns nothing, even though the "Agents over MCP" article and its sections say exactly that. The chat then tells the user that Utopia has no docs on the topic.

What changes

The docs index registers jieba followed by tantivy's LowerCaser. The same analyzer is used at query time, so both sides are lowercased. DocsIndex is built in RAM from compile-time markdown at every start, so nothing on disk changes and no reindex is needed. The persisted SearchIndex is untouched.

How it was checked

  • A new test, a_query_finds_the_section_whatever_its_letter_case, indexes two sections and expects MCP client, mcp client, Mcp, settings and SETTINGS each to find a hit, with mcp ranking the MCP section first and access TOKEN ranking the token section first.
  • With the fix reverted the test fails: "Mcp" found nothing.
  • cargo test -p utopia-search: 8 passed.
  • cargo fmt --all --check and cargo clippy -p utopia-search --all-targets -- -D warnings pass.

Before review

  • Every commit is signed off (git commit -s)
  • cargo fmt --all --check, cargo clippy and cargo test pass for the touched crate

…nts over MCP" sections instead of nothing

Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
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