Page 1 of 1

A method to suggest other names when user makes typos

Posted: Thu Nov 03, 2005 4:14 am
by guarriman
Hello.

Working with Apache+PHP+MySQL, I'm developing a website to allow users to find within a product catalog. Product info is stored within a MySQL table (ID, name, price).

These users usually make typos and mistakes when typing the product name, and I want to suggest them other names, similars to the typed one. For instance:
mp3 playr --> mp3 player

Does anybody know any algorithm or method to perform it? Thank you very much.

Posted: Thu Nov 03, 2005 4:27 am
by Chris Corbyn

Code: Select all

select some_data from some_table where some_field sounds like 'mp3 playr';

or.....

select some_data from some_table where soundex(some_field) = soundex('mp3 playr');
Never used that syntax but a quick flick through the mysql manual sounds like it should work using the soundex algo :)