Uni Ecto Plugin Today

Uni Ecto Plugin Today

render(conn, "index.html", query: query, results: results, total_count: length(results) ) end

timestamps() end

# Optional: Add precomputed tsvector column alter table(:posts) do add :search_vector, :tsvector end uni ecto plugin

defp apply_full_text_search(query, %search_term: term) when is_binary(term) and term != "" do from q in query, where: fragment( "to_tsvector('english', ?) @@ plainto_tsquery('english', ?)", fragment("coalesce(?, '') || ' ' || coalesce(?, '')", q.title, q.content), ^term ) end defp apply_full_text_search(query, _), do: query render(conn, "index