Torus - Integrate PostgreSQL's search into Ecto queries

Hey! Thanks a lot! So we’ve been using it this way:

  def search(query, term) when length(term) < 3 do
    term = Torus.sanitize(term)

    Torus.ilike(query, [u], [u.username], term <> "%")
  end

  def search(query, term) do
    Torus.similarity(query, [u], [u.username], term)
  end

But yes, there are plans to make it composable so that you can use different search types in a single query!
And regarding the sanitization, I’ve opted to expose Torus.sanitize/1 instead of embedding it into the term itself. Probably should improve the visibility of it though

1 Like