# CJK Cross-Script Search Type `萬維鋼` in Obsidian's global search and find files containing `万维钢`. And vice versa. ## What it does Obsidian's native global search (`Cmd+Shift+F` / `Ctrl+Shift+F`) treats Simplified and Traditional Chinese as different strings — searching `萬維鋼` will not surface a note that only contains `万维钢`. This plugin closes that gap by rewriting your query using Obsidian's native `OR` syntax before it hits the search engine. It also bridges common Taiwan/Mainland term variants like `軟體` ↔ `軟件` ↔ `软件` via OpenCC's `s2tw` / `tw2s` mapping. Both **typing into the search box** and **programmatic search calls** are covered. CJK input methods (注音 / 拼音 / 日文 / 한국어) are not disrupted — the plugin pauses rewriting during IME composition so the candidate window keeps working normally. ## Where it works - ✅ Global search panel (`Cmd+Shift+F` / `Ctrl+Shift+F`) — both user typing and programmatic calls - ❌ Quick Switcher (`Cmd+O`) — use [lazyloong/obsidian-fuzzy-chinese](https://github.com/lazyloong/obsidian-fuzzy-chinese) for that - ❌ Tag pane / backlinks pane — deferred to v2 ## What gets expanded | Input | Matches | |-------|---------| | `萬維鋼` | files containing `萬維鋼` or `万维钢` | | `万维钢` | files containing `万维钢` or `萬維鋼` | | `軟體` | files containing `軟體`, `軟件`, or `软件` (Taiwan variant only) | | `path:筆記/ 萬維鋼` | `path:` operator passes through; `萬維鋼` expanded | | `/萬維鋼/` | left as-is (you wrote a regex, plugin trusts you) | | `MIT` | unchanged (no CJK) | | `的` | unchanged (single CJK char threshold) | Under the hood, `萬維鋼` becomes `(萬維鋼 OR 万维钢)` — Obsidian's native `OR` operator, not a regex blob. Your input box keeps showing what you typed; only the underlying query gets expanded. ## Settings - **Enable cross-script search** — master toggle. - **OpenCC variant** — `Taiwan` (default, bridges Taiwan idioms like 軟體↔软件) or `Basic` (char-level only, fewer false positives). - **Debug log to console** — prints every rewritten query so you can see what's being sent to search. ## Compatibility - **Obsidian ≥ 1.5.0** required. Earlier versions exposed different search internals; this build was designed against the current internal API. - Desktop and mobile both supported (no `isDesktopOnly`). ## Known limitations - Quick Switcher / tag pane / backlinks not covered. See "Where it works". - Negated terms (`-廢文`) are not expanded. - The `Taiwan` variant can produce false positives for terms with the same form but different meaning across regions (e.g. `程序` means "program" in Mainland but also "procedure" in Taiwan). If this bothers you, switch to `Basic`. - Hooks Obsidian internals (`SearchView.setQuery` prototype + `SearchComponent.changeCallback` per-instance). An Obsidian upgrade that renames these may temporarily break the plugin until updated. - Bundle size ~2 MB (OpenCC dictionaries). One-time cost; lazy-loading on first query keeps startup fast. ## Install (manual, while pending community-store approval) 1. Download `main.js` and `manifest.json` from [Releases](https://github.com/sai1047976/obsidian-cjk-cross-search/releases). 2. Drop both into `/.obsidian/plugins/cjk-cross-search/`. 3. Reload Obsidian and enable the plugin in Settings → Community Plugins. ## Build from source ```bash git clone https://github.com/sai1047976/obsidian-cjk-cross-search cd obsidian-cjk-cross-search npm install npm run build ``` The build emits `main.js` in the repo root. Drop that plus `manifest.json` into your vault's plugin folder. ## License MIT. See [LICENSE](LICENSE).