vendredi 6 février 2015

Parse special characters with matching regular characters

I have a search input where you can search for wines. I have some wines that contain characters like é (e.g. Dom Pérignon).


Currently if I am to type Dom Perignon then I wont get the above example wine. But what I wish to achieve is that if I typed e instead of é I would still get the Dom Pérignon wine.


The search mechanism itself is basic.


The input:



<input id="search" type="text" placeholder="Search for wine or producer..." ng-change="search()" ng-model="data.search">


And the SQL querying:



DB.query("SELECT id, name, ... FROM wines WHERE name LIKE ? OR house_name LIKE ? LIMIT 20", [searchFilter + '%', searchFilter + '%'])


How could I achieve the ability that typing e would also parse wines containing é?


Aucun commentaire:

Enregistrer un commentaire