Repository navigation
feat(wiki-mcp): add catalog IDF weighting and ask_hub search_terms query expansion - #256
Open
humandebri wants to merge 3 commits into
Open
humandebri wants to merge 3 commits into
humandebri wants to merge 3 commits into
Conversation
humandebri
force-pushed
the
feat/hub-router-idf-and-query-expansion
branch
2 times, most recently
from
December 3, 2026 06:08
040484f to
87f97b2
Compare
…upe tokenization in routeAndQueryHub, and add IDF/search_terms PBT
humandebri
force-pushed
the
feat/hub-router-idf-and-query-expansion
branch
from
December 3, 2026 06:37
87f97b2 to
2c50c41
Compare
humandebri
deleted the branch
fix/hub-router-katakana-and-multilingual-fallback
December 3, 2026 06:37
humandebri
changed the base branch from
fix/hub-router-katakana-and-multilingual-fallback
to
main
December 3, 2026 06:39
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
Stacked on #253 (
fix/hub-router-katakana-and-multilingual-fallback). Addresses vocabulary mismatch and high-frequency generic-term over-matching inask_hubwithout per-dataset hardcoding or extra LLM calls:Optional
search_termsparameter onask_hub(zero-cost caller LLM query expansion):search_terms?: string[](max 12 terms) toaskHubInputSchemainworkers/wiki-mcp/src/index.tsandAskHubInputinworkers/wiki-mcp/src/hub-router.ts.mergeQueryTokens), prioritized inqueryContextentities, and tried first on zero-hit fallback so article-level terms are not shadowed by broader DB-name tokens.Catalog IDF weighting (
catalogIdfWeight):0.2 + 0.8 * log(N / df) / log(N)forN >= 3,1.0fordf <= 1orN < 3) to both ASCII (postingsList.length) and CJK (tokenTouched.length) matches inO(1)time andO(1)extra space.日本,会社,hub:dataset) from falsely attracting colloquial queries while preserving 100% weight for unique domain terms and keeping the 1,000-DB benchmark >500x faster than naive scan.Verification
tsc --noEmit: 0 errors.vitest run: 18/18 files, 343/343 tests passed (including updated 80-trial randomized EN/CJK property test with IDF parity, IDF damping +search_termsunit tests, MCP schema verification, and 525.0x inverted-index benchmark speedup).