This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Levenshtein function | |
-- Source: https://openquery.com.au/blog/levenshtein-mysql-stored-function | |
-- Levenshtein reference: http://en.wikipedia.org/wiki/Levenshtein_distance | |
-- Arjen note: because the levenshtein value is encoded in a byte array, distance cannot exceed 255; | |
-- thus the maximum string length this implementation can handle is also limited to 255 characters. | |
DELIMITER $$ | |
DROP FUNCTION IF EXISTS LEVENSHTEIN $$ | |
CREATE FUNCTION LEVENSHTEIN(s1 VARCHAR(255) CHARACTER SET utf8, s2 VARCHAR(255) CHARACTER SET utf8) |