Set custom similarity limit.

This commit is contained in:
lain 2019-01-20 10:57:49 +01:00
parent b108aeee08
commit 5834b08fe7
1 changed files with 5 additions and 1 deletions

View File

@ -686,7 +686,11 @@ def search(query, resolve \\ false, for_user \\ nil) do
fts_results = do_search(fts_search_subquery(query), for_user) fts_results = do_search(fts_search_subquery(query), for_user)
trigram_results = do_search(trigram_search_subquery(query), for_user) {:ok, trigram_results} =
Repo.transaction(fn ->
Ecto.Adapters.SQL.query(Repo, "select set_limit(0.25)", [])
do_search(trigram_search_subquery(query), for_user)
end)
Enum.uniq_by(fts_results ++ trigram_results, & &1.id) Enum.uniq_by(fts_results ++ trigram_results, & &1.id)
end end