Skip to content

[Proposal] Pinyin-aware search for Chinese applications/bookmarks #311

Description

@xuelingkang

Hi, opening this to discuss a search improvement for Chinese users.

Problem

Currently, searching Chinese items (e.g. "微信") requires typing Chinese characters. Pinyin input ("weixin", "wx", "wei xin") doesn't work because the minisearch index tokenizes on whitespace/punctuation only — CJK characters remain whole tokens.

Proposed direction

Generate latin variants (pinyin + initial letters) for CJK items at index time, so that:

  • "weixin" → matches "微信" ✓
  • "wx" → matches "微信" ✓
  • "we" → matches "微信" (prefix) ✓

Implementation plan:

  • Add a lightweight pinyin library (tiny-pinyin, ~8KB gzipped)
  • Generate variants (weixin, wx, wei, xin) per CJK name on item creation
  • Add a hidden search field _latinVariants to the minisearch index (not exposed in UI)
  • Leave fields registry open: { zh: pinyin, ja: kana, ... } so future languages can plug in

What changes

  • New file: src/lib/pinyin.ts — variant generation
  • Modified: src/stores/ui.store.tsx — index config + preprocessing (~50-80 lines)
  • Added: 1 npm dependency (tiny-pinyin)
  • UI changes: none (pure under-the-hood search enhancement)

Scope

No config migration, no UI changes, backward-compatible. Chinese users gain pinyin search; others see zero impact.

Happy to discuss if this fits the project direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions