Message search is case-sensitive for non-ASCII letters (e.g. "über" does not find "Über", "привет" does not find "Привет")

Ouverte
#7,942 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
1-2 jours
Accessibilité débutants
52/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
haskell, sqlite
Domaine
database, search

Piste de recherche

Start with connectDB in Simplex.Messaging.Agent.Store.SQLite to see how SQLite connections register functions, then inspect searchCond in src/Simplex/Chat/Store/Messages.hs and the three getAllChatItems queries. Check the pinned direct-sqlcipher API and existing search tests; done means SQLite message and chat list searches find case-folded non-ASCII text while PostgreSQL behavior remains unchanged, with scan cost measured on a large database.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Describe the bug

Searching messages, in a single chat or across all chats, ignores case only for the ASCII letters A–Z. For any other letter the case must match exactly:

Search Message Found
test Testing yes
über Über no
привет Привет no
γεια Γεια no
straße STRASSE no

This affects every language with letters outside ASCII (German, French, Russian, Ukrainian, Greek, Turkish, Polish, …), in all apps, because the search runs in the core.

To reproduce

  1. Receive a message "Über morgen".
  2. Search for "über" in the chat, or with /_get items count=50 search=über.
  3. No result. Searching "Über" finds it.

Cause

The SQLite queries compare LOWER(item_text) LIKE '%' || LOWER(?) || '%' (src/Simplex/Chat/Store/Messages.hs: searchCond in getChatItemIDs, which the single-chat loads use, and the three queries in getAllChatItems). SQLite's built-in LOWER() and LIKE fold ASCII only unless SQLite is built with ICU, which the bundled sqlcipher is not. The chat list's name filters (contact and group names, aliases) use the same LOWER(…) LIKE pattern and miss the same way.

Proposed fix

Register a deterministic scalar function when a SQLite connection is opened, e.g. simplex_fold(text), implemented with Data.Text.toCaseFold through Database.SQLite3.Direct.createFunction (available in the pinned direct-sqlcipher), and use it on both sides in the SQLite build only:

simplex_fold(item_text) LIKE '%' || simplex_fold(?) || '%'
  • Registration fits next to the existing pragmas in connectDB (simplexmq, Simplex.Messaging.Agent.Store.SQLite), so every connection in the pool has it.
  • The PostgreSQL build keeps LOWER, which is already Unicode-aware there.
  • toCaseFold also handles full folding (ß → ss) and the Turkish dotted İ.
  • Cost: one Haskell callback per scanned row instead of the built-in LOWER. The search is already a full scan of chat_items, so the difference should be measured on a large database before merging.

We would be happy to open a PR for this if the approach is acceptable.

Langage dominant
Haskell
Étoiles
19.8k
Forks
1.3k
Merge moyen
1 j 6 h
PR mergées (30 j)
233

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de simplex-chat/simplex-chat

Toutes les issues de simplex-chat/simplex-chat

Issues similaires

Plus d'issues Haskell

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.