Elixir Blog Posts

Enjoyed reading it!

Regarding:

SET pg_trgm.similarity_threshold = 0.3;

Sadly, at the time of writing, we were not able to find a solution that allows us to configure this threshold for an Ecto.Repo (tips are more than welcome).

You could do:

query_args = ["SET pg_trgm.similarity_threshold = 0.3", []]

config :my_app, MyApp.Repo,
  username: "postgres",
  password: "postgres",
  database: "demo_dev",
  hostname: "localhost",
  pool_size: 10,
  after_connect: {Postgrex, :query!, query_args}

The above is an adjusted excerpt from the ebook “The Little Ecto Cookbook” by Dashbit, where they showed how to set a particular schema for a repo.

4 Likes