I have this company table :
TABLE company
+----+----------------+--------+--------+
| id | name | rating | enable |
+----+----------------+--------+--------+
| 1 | Spirit company | 3.5 | 1 |
| 2 | Test | 2 | 1 |
| 3 | Hello world | 4 | 1 |
+----+----------------+--------+--------+
When the user make a research, this query is made (exemple with search=spirit company):
SELECT `company`.*,
1+IF(`name` REGEXP 'sp[iíìîï]r[iíìîï]t[ -][cç][oóòôöõø]mp[aáàâäåã][nñ][yýÿ]',10,
IF(`company`.`name` REGEXP '(sp[iíìîï]r[iíìîï]t)|([cç][oóòôöõø]mp[aáàâäåã][nñ][yýÿ])',5,0)
) as `ratio`
FROM `company`
WHERE `company`.`enable`=1
ORDER BY`ratio` DESC, `company`.`rating` DESC
It's works fine! Now if the user makes a typo, it is possible to give a middle result ?
Exemple: user search 'spitit company', i want to add +3 to the ratio because just one letter is different.