Set custom similarity limit.
authorlain <lain@soykaf.club>
Sun, 20 Jan 2019 09:57:49 +0000 (10:57 +0100)
committerlain <lain@soykaf.club>
Sun, 20 Jan 2019 09:57:49 +0000 (10:57 +0100)
lib/pleroma/user.ex

index 87815e11c9dd0f26598a0f7466661c18352b8b1c..955808e285ebee00bd81d7e3afb2334a353587b3 100644 (file)
@@ -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