feat(search): client-side hybrid lexical + semantic tool search - #12
Merged
Conversation
nx10
commented
Jun 8, 2026
Contributor
Upgrade the QuickSelector from boolean substring matching to a hybrid
search that blends lexical relevance with semantic (embedding cosine)
ranking, so capability/synonym queries ("skull strip" -> fsl/bet,
"remove noise" -> ants/DenoiseImage) work, not just exact names.
- New src/lib/services/search/: lexical scoring, a pure cosine+blend core
(kept DOM/Svelte-free so it can later move to a shared package both the
hub and niwrap-mcp import), a version-keyed index loader that validates
the matched-pair invariant, and an embedder worker (transformers.js,
Xenova/all-MiniLM-L6-v2) that lazily loads the model on first search.
- Tool vectors are fetched from the published per-version embeddings
artifacts on Pages (see niwrap-mcp/docs/embeddings-contract.md); every
failure path degrades to lexical.
- On-by-default, opt-out gating: capable desktops auto-run semantic;
mobile/save-data/slow/low-memory default to lexical. Auto/On/Off toggle
persisted to localStorage.
- Lexical renders instantly; the list upgrades to the blended ranking
when the query embedding resolves (debounced, stale-query guarded).
- Catalog store now exposes tool refs (with descriptions) + the
embeddings announce.
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.