From: lain Date: Sun, 20 Jan 2019 09:57:49 +0000 (+0100) Subject: Set custom similarity limit. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=5834b08fe77250d1dad0f2f6cd148f2fd8f85c09;p=akkoma Set custom similarity limit. --- diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 87815e11c..955808e28 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -686,7 +686,11 @@ defmodule Pleroma.User 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