I am trying to get an ecto-like request like this:
def find(searchterm) do query = from c in Contact,
In my table, I have the Asymptot company name. Using where: for example / 2 my query looks like this:
SELECT c0."id", c0."company_id", c0."company_name" FROM "contacts" AS c0 WHERE (c0."company_name" LIKE $1) ["Asym"] (1.0ms)
when pg_trm search is uncommented, it looks like this:
SELECT c0."id", c0."company_id", c0."company_name" FROM "contacts" AS c0 WHERE (c0."company_name" % $1) ["Asym"] (1.0ms)
As far as I can see, the queries look good, but there are no results. Since I added the index after adding Asymptot to the database, I expect that is why it is not found in the pg_trm index, but why not like / 2 or ilike / 2? When I enter the full name of Asymptot, I can find the entry.
phoenix-framework ecto
Dania_es
source share