Thankfully MySQL has the soundex function built in, which should reduce the result set dramatically.
Code:
SELECT * FROM `words` WHERE SOUNDEX(`word`) = SOUNDEX('$search')
Store these into an array and then (why is there no recursive array sort function?):
PHP Code:
for($i = 0; $i < (count($words) - 1); $i++)
if(levenshtein($words[$i], $search) > levenshtein($words[$i + 1], $search)) {
$temp = $words[$i];
$words[$i] = $words[$i + 1];
$words[$i + 1] = $temp;
}
I'm only guessing here though as I've never attempted fuzzy searching before
Bookmarks