1
0
Fork 0
forked from mirrors/akkoma

Set custom similarity limit.

This commit is contained in:
lain 2019-01-20 10:57:49 +01:00
parent b108aeee08
commit 5834b08fe7

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)
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)
end