The problem with the register [upper/lowercase searching]

If I search for an English word, it is found regardless of which case it is written in.

But if I do a search for a Russian word, then I need to enter it in exactly the same case to find it.

Read more on the video. Android Samsung S23 Ultra

I don’t think your video posted. I’m not sure a video is needed to demonstrate an issue with case searching, but you can `post it between backticks` if you think it’s important.

What would be most helpful is if you can give examples of words you’ve had this issue with in Russian – both in the “wrong” case that doesn’t find the word, and the right one. You should also go to Settings > About – click “Copy debug info” – paste that here.

Hello. Initially, there was a ban on embedding links, and I also couldn’t attach the file. I don’t mean the case, but the case. Capital and small letters. The video shows that when I enter a capital letter and then a small one, the result is different, but everything works correctly in English.

I don’t have permission to send links. That’s why I’m sending it in this form. If something is not clear, ask.

I’m writing through a translator. Sometimes he doesn’t translate accurately, I think everything will be clear on the video.

https:// www .youtube.com/watch?v=NL7eLldGyzc

I watched the video. It is 48 seconds long, a mobile phone screen recording, showing the AnkiDroid app being used. The app has a UI that appears to be Russian and is being used with a deck named “English”.

The user browsed the deck. There was one Note that contained:

  • Question field: Аксессуар, вспомогательный, дополнительный, добавочный, фурнитура, оборудование, арматура
  • Answer field: Accessory

Please note the specific words and capitalizations found in the Note:

  • Аксессуар
  • вспомогательный
  • Accessory

The user then used the search function with these search terms:

  • аксессуар (No results were found. Bug?)
  • Аксессуар (The correct note was found.)
  • вспомогательный (The correct note was found.)
  • Вспомогательный (No results were found. Bug?)
  • accessory (The correct note was found.)
  • Accessory (The correct note was found.)
3 Likes

Right. If the word in Russian is written in small letters in the deck, then if you enter large letters when searching, the word will not be found. But in English, it doesn’t matter if the word is written in small or large letters, and it doesn’t matter which letters you type into the search − it will still be found.

In Russian, the search is case-sensitive, but in English it is not. It would be great if the case was also ignored in Russian.

I am able to reproduce the same problem behaviors on both Mac desktop Anki and ios AnkiMobile, using the above example Note and search terms. (I do not have access to AnkiDroid.)

For both of my devices, the OS system language was set to “English”. However, for the Mac desktop app, the bug occurs even when I set the Anki app UI language to Russian, via Anki Preferences.

It could be that the Anki app is using English language localization for its capitalization and sorting rules (so the app might not be aware that Russian “в” and “В” are the same letter with different capitalizations). When checking to see if a different language could be set for the Mac desktop Anki app, I see the note that “Anki.app doesn’t support additional languages”.

(I did not test changing my OS system language to Russian on either device.)

I found a workaround. The workaround is to prepend re: before the search term, to do a regular expression search (which are case insensitive by default). For example:

  • re:аксессуар
  • re:Вспомогательный

I have been using AnkiDroid for several years now and this problem has been around since I started using it. Interesting solution, add “re:”.Add “re:” to the search query every time. It’s a very long time. This makes the search long and inconvenient. I assume that you need to find a part of the code where it is indicated for the Russian language to use the check for uppercase and lowercase letters and just cancel it.

SQLite only understands upper/lower case for ASCII characters by default. The LIKE operator is case sensitive by default for unicode characters that are beyond the ASCII range.
SQL Language Expressions

It’s possible to introduce a custom implementation but it’ll also slow down searching in the general case

OP, the behavior you posted about is already mentioned in Anki documentation.

https://docs.ankidroid.org/#_searching

AnkiDroid supports all the search strings that the desktop version of Anki does […] For a full list of the possibilities, please see the section in the desktop manual.

https://docs.ankiweb.net/searching.html#searching

  • Standard searches are case insensitive for Latin characters - a-z will match A-Z, and vice versa. Other characters such as Cyrillic are case sensitive in a standard search, but can be made case insensitive by searching on a word boundary or regular expression (w:, re:).

However, I filed an enhancement request to have Anki consider using the SQLite ICU extension which, as I understand it, would result in case-insensitive searches for all characters: Use SQLite ICU extension to enable case-insensitive searches for non-Latin characters · Issue #4302 · ankitects/anki · GitHub

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.