Levenshtein algorithm in MySql and accented charac

2019-07-25 10:33发布

I use the Levenshtein plugin for MySQL from: http://samjlevy.com/2011/03/MySQL-levenshtein-and-damerau-levenshtein-udfs/

I'm trying a query like:

SELECT name FROM database WHERE levenshtein(name, 'testć')

the problem is that levenshtein function doesnt handle accented characters. I need levenshtein to recognize characters like "C" and "Ć" (and others accented) as the same. So i decided to replace all of it in MySQL, but cant find any function for that. Like:

SELECT name FROM database WHERE levenshtein(toAscii(name), toAscii('testć'))

I dont want to use something like REPLACE( REPLACE(name, "ś", "s"), "ć", "c" ); It may be slow and it looks horrible.

0条回答
登录 后发表回答