Tatoeba / tatoeba2

Tatoeba is a platform whose purpose is to create a collaborative and open dataset of sentences and their translations.
https://tatoeba.org
GNU Affero General Public License v3.0
714 stars 132 forks source link

make tags lowercase before comparing them #3051

Open vinkaks opened 1 year ago

vinkaks commented 1 year ago

Attempt to fix #3050. Issue results in a false error.

Issue is due to the applied tags vs user submitted tags check being case sensitive even though the database search used to generate applied tags is case insentitive.

jiru commented 1 year ago

Thanks for your PR! It appears the default collation makes varchar type case-insensitve by default, whereas the code assumes it is case-sensitve. Even though I didn’t know tags are case insensitive, we may want to keep it like this.

\App\Model\Search::filterByTags() is supposed to return the list of tags that have been successfully applied among the provided tags. Because that method is doing the SQL query, I think it would make more sense to have it handle the case thing, instead of its caller App\Form\SentencesSearchForm::setDataTags(). The caller shouldn’t have to deal with such implementation details. Can you try modifying filterByTags() in a way it works regardless of the case?