Accent insensitive search with MYSQL not working

9 months ago
nopcommerce 4.50 on mysql 8.0.30 running on Linux
my product names are in central european language. My DB and tables are set to UTF8MB4_0900_ai_ci

i can search the database case insensitively with
select * from Product where Name LIKE "%vyfuk%";
which gives the expected results

but searching words without accent gives no results
searching for "vyfuk" gives no result while searching for "výfuk" gives me the results
9 months ago
You may want to try utf8_unicode_ci
9 months ago
and why would i do that?
9 months ago
Because how the collation / comparisons are done is slightly different.
https://stackoverflow.com/questions/54885178/whats-the-difference-between-utf8-unicode-ci-and-utf8mb4-0900-ai-ci
9 months ago
how is that even possible it could work better with nopcommerce code?
9 months ago
You said it yourself:
theruck wrote:
...i can search the database case insensitively with
select * from Product where Name LIKE "%vyfuk%";
which gives the expected results

but searching words without accent gives no results
searching for "vyfuk" gives no result while searching for "výfuk" gives me the results


LINQ to DB explicitly translates your LINQ queries into SQL and maps the result to your application object model.
9 months ago
I thought this is a bug report. None of the replies received here are fixing the problem
9 months ago
Anyway, changing the collation of the database, table and column does not fix the problem. To be clear, it had no chance to fix the problem either as the previous collation was superior to the unicode ai ci collation
9 months ago
New York wrote:
You said it yourself:
...i can search the database case insensitively with
select * from Product where Name LIKE "%vyfuk%";
which gives the expected results

but searching words without accent gives no results
searching for "vyfuk" gives no result while searching for "výfuk" gives me the results

LINQ to DB explicitly translates your LINQ queries into SQL and maps the result to your application object model.

so is the LINQ query written properly to ignore accent or not? https://stackoverflow.com/questions/7418624/linq-where-ignore-accentuation-and-case
9 months ago
You again miss the point.  It has nothing to do with how the LINQ is written.  Reread the accepted answer on the stackoverflow LINQ you provided above.  
Change the collation.  (You can first create a temporary table), and then just test with plain SQL.