I'm trying to get a list of entities from a DB (by the column "name") where the input may be a substring and I need it to be accent (and case) insensitive. E.g. "zs" should also find "ažšb".
I found a collation for accents and used this:
CREATE COLLATION ignore_accent (provider = icu, locale = 'und-u-ks-level1-kc-true', deterministic = false);
CREATE INDEX users_name_ignore_accent_idx ON users(name COLLATE ignore_accent);
SELECT * FROM users WHERE name = ' "+ name +"' COLLATE ignore_accent;
This worked well for the accents, but not for substring of course. So I changed the equals to LIKE '%" + name + "%' but this did not work, as LIKE apparently works only with deterministic collation.
So I deleted the collation and created a new, deterministic one. Now the select (which I use for search) works by substring but ignores the collation.
Is there any way to search by a substring, accent insensitive? Or any other option (Java, Spring, JPA)? Thank you.