Skip to content

Inconsistent search query handling: Korean characters are ignored in mixed-input searches unlike English #5044

@hi2242

Description

@hi2242

Describe the bug

First of all, thank you for the great work on VitePress. I really enjoy using it.

I noticed an inconsistency in the search behavior when mixing numbers with different languages.

  • English + Number: When searching for a non-existent token like eeee9, the search correctly returns "No results found".

  • Korean + Number: When searching for a non-existent token like ㄷㄷㄷㄷ9, the search seems to ignore the Korean characters (ㄷㄷㄷㄷ) and returns results matching only the number 9.

This inconsistency might confuse users, as the strictness of the search query varies depending on the language used. I believe the behavior should be consistent regardless of the input language.

Reproduction

  1. Open the search bar in a VitePress site.

  2. Type eeee9: Observe that "No results found" is displayed (Correct behavior).

  3. Type ㄷㄷㄷㄷ9: Observe that it displays results containing the number 9, effectively stripping the Korean characters (Inconsistent behavior).

Image

Expected behavior

Searching for ㄷㄷㄷㄷ9 should return "No results found", strictly matching the entire query string just like the English example (eeee9). It should not fall back to partial matching by dropping characters.

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (12) x64 13th Gen Intel(R) Core(TM) i5-1335U
    Memory: 4.44 GB / 15.69 GB
  Binaries:
    Node: 22.19.0 - C:\nvm4w\nodejs\node.EXE
    Yarn: 1.22.22 - C:\nvm4w\nodejs\yarn.CMD
    npm: 10.9.3 - C:\nvm4w\nodejs\npm.CMD
    pnpm: 10.22.0 - C:\nvm4w\nodejs\pnpm.CMD
  Browsers:
    Chrome: 142.0.7444.176
    Edge: Chromium (140.0.3485.54)
    Internet Explorer: 11.0.26100.1882

Additional context

I suspect this issue arises from the default query expansion settings in the underlying search implementation.

To ensure a consistent UX, I suggest enforcing stricter query handling by setting removeWordsIfNoResults: 'none' in the search client configuration. (In src/client/theme-default/components/VPAlgoliaSearchBox.vue)

I would love to contribute to fixing this issue. Could you please assign this issue to me? I am ready to submit a Pull Request.

Image

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions