I have a data table and I would like to filter the columns. For example, to search for a user by his fullname.
However, I would like to allow the user to enter the search phrase case-independent and accents-independent.
So I have checked these (and more) sources and questions:
- https://stackoverflow.com/a/11007216
- How to ignore case sensitive rows in PostgreSQL
- https://www.postgresql.org/docs/current/collation.html#COLLATION-NONDETERMINISTIC
I thought the nondeterministic collations might finally be the right way how to achieve that, but unfortunately I don't know how:
- combine case_insensitive and ignore_accents into one collation
- how to allow searching only by substring in such a WHERE (e.g., find "Jóhn Doe" only by the string "joh") as nondeterministic collations do not support LIKE or regular expressions
- which index to use
I would be very grateful for any advice on how to finally deal with this type of problem.
Thanks!