I have a database of 30k elements, each game names.
I’m currently using:
SELECT * from gamelist WHERE name LIKE '%%%$search%%%' OR aliases LIKE '%$search%' LIMIT 10"
for the searchbar.
However, it can get really picky about things like:
'Animal Crossing: Wild World'
See, many users won’t know that ‘:’ is in that phrase, so when they start searching:
Animal Crossing Wild World
It won’t show up.
How can I have the sql be more forgiving?
Replace the non alphanumeric characters in the search parameter with wildcards so
Animal Crossing Wild Worldbecomes%Animal%Crossing%Wild%World%and filter on that.