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.
A method to suggest other names when user makes typos
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
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');