Skip to content

ReverseHighlight does not highlight Cyrillic characters correctly #1317

@Augen2203

Description

@Augen2203

Hi Algolia team 👋

I'm using @algolia/autocomplete-js together with these plugins:

  • @algolia/autocomplete-plugin-query-suggestions
  • @algolia/autocomplete-plugin-recent-searches

I've encountered an issue where highlighting with fails to wrap matched parts when using Cyrillic characters (e.g. Ukrainian or Russian). For Latin characters, everything works fine — matches are wrapped and highlighted as expected.

🧪 Observations

  • Queries are correctly matched — verified in logs.
  • However, <components.ReverseHighlight> doesn't wrap Cyrillic matches in highlighting tags.
  • Replacing with <components.Highlight> resolves the issue.

✅ Temporary Workaround

// Before:
<components.ReverseHighlight hit={item} attribute="query" />

// replaced with:
<components.Highlight hit={item} attribute="query" />


<components.ReverseHighlight hit={item} attribute="label" />
// replaced with:
<components.Highlight hit={item} attribute="label" />

Expected Behavior
should correctly highlight substrings in Cyrillic scripts.

###💡 Possible Fix
It seems related to Unicode-aware string matching or regex. Enhancing ReverseHighlight to support non-Latin alphabets—or documenting that Highlight is preferred for such cases—would be valuable.

Thanks for maintaining Autocomplete — it’s a fantastic tool!

Sources:

autocomplete-plugin-query-suggestions

autocomplete-plugin-recent-searches

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions