ankitects / ankitects/anki

Improve the SqlWriter API to make node grouping less error-prone

Ouverte
#5,506 0 commentaires 0 réactions 1 personne assignée Réclamée par @iamllama Voir sur GitHub
Langage dominant
Rust
Étoiles
30.5k
Forks
3.2k
Merge moyen
2 j 8 h
PR mergées (30 j)
60

Description

write_search_node_to_sql() has a comment about wrapping the SQLite for every multi-term search node in parentheses to generate the correct conditions:
https://github.com/ankitects/anki/blob/d80273ea71d4e9a3cab91b5a2e5906366809e3ea/rslib/src/search/sqlwriter.rs#L127-L129

It's easy to miss that though and introduce bugs as happened recently (#5500) and in the past when the API was introduced (https://github.com/ankitects/anki/pull/1754#issuecomment-1081282942) so it's worth looking into improving this.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Start in rslib/src/search/sqlwriter.rs at write_search_node_to_sql() and read the comment around lines 127-129. Review the grouping problem described in #5500 and the prior API discussion in pull request #1754. Done means the SqlWriter API makes it difficult to omit the parentheses needed for multi-term search nodes and avoids the reported class of SQL-condition bugs.

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

Évaluation

Stack technique
rust, sqlite
Domaine
databases
Type d'issue
Refactorisation
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Active
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

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