Reputation: 713
I have a POSTGRESQL Database with names like:
ʿImād ad-Daula Abu ᾽l-Ḥasan
The user may select this value by typing into a text field. But I would like the user to use similar characters. So, that he can type: "imad" or "hasan". And still get the same result.
It seems a kinda basic problem to me, but I have not found a solution so far.
I tried it with:
SELECT * FROM person WHERE name ILIKE '%hasan%' ORDER BY name ASC
But it doesn't work for these characters. I would be really greatful for suggestions.
Thanks
Upvotes: 1
Views: 249
Reputation: 23676
You can install the extension unaccent
:
CREATE EXTENSION unaccent;
And then you are able to do:
SELECT * FROM person WHERE unaccent(name) ILIKE '%hasan%' ORDER BY name ASC
Upvotes: 1