II have this quey in which we can search based on first name and last name. And it works fine like this:
|> where(
[user],
ilike(user.first_name, ^string) or ilike(user.last_name, ^string)
)
It works fine. Now I want to search on a full name that is first_name + last_name
. I tried this approach of Postgres.
|> where(
[user],
ilike(user.first_name, ^string) or ilike(user.last_name, ^string) or ilike(fragment("(?)||' '||(?)", user.first_name, user.last_name), ^string)
)
I also tried this:
ilike(fragment("CONCAT((?), ' ',(?))", user.first_name, user.last_name), ^string)
But it doesn’t work either it’s returning no result.
Is there anything I am missing?
Thanks