Skip to content

The magic search works case-sensitive if you use a language other than English. #543

@Randry1

Description

@Randry1

Hi, thanks for your cool app.

  1. Describe the bug

The magic search works case-sensitive if you use a language other than English.

If I start searching for a contact signed in Ukrainian, the search works only in case-sensitive English, everything works fine, case-insensitive.

  1. To Reproduce

Create outlines with a capital letter
Андрій
Олександр
Марія

Try to add one of the contacts to the group by writing the name with a little boova
андрій
's contact Андрій will not be found

  1. Expected behavior

It is expected that the contact search will work the same way as in English, case-insensitive.

I tried to fix the problem, but my knowledge wasn't good enough.

Here's what I found:

  1. The search is performed using regular expressions. The setupRegex function in magic-search.cpp
    creates a regular expression from the search string.
  2. The lines are reduced to lowercase. The setupRegex and getWeight functions have both a filter and a text.,
    which is being searched for, converted to lowercase using tolower(). It means,
    that the search should already be case insensitive.

However, there is one caveat. setupRegex uses std::regex, and getWeight uses
regex_match. By default, std::regex can be case-sensitive depending on
the compiler and OS implementation.

To ensure case insensitivity, I will add the std::regex::icase flag when
creating the std::regex object.

  1. Please complete the following information
  1. SDK logs

Does not write any errors in the logs

  1. Adb logcat logs

Does not write any errors in the logs

Image

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions