Encapsulation of tags / hashtags fetching from objects.
[akkoma] / lib / pleroma / activity / search.ex
index 8449b9b004755b597d7d2ab3aa953d67d37c781f..babf9520ba680398f5c434daebe752dbc78bc7a3 100644 (file)
@@ -19,7 +19,12 @@ defmodule Pleroma.Activity.Search do
     offset = Keyword.get(options, :offset, 0)
     author = Keyword.get(options, :author)
 
-    search_function = Pleroma.Config.get([:instance, :search_function], :plain)
+    search_function =
+      if :persistent_term.get({Pleroma.Repo, :postgres_version}) >= 11 do
+        :websearch
+      else
+        :plain
+      end
 
     Activity
     |> Activity.with_preloaded_object()
@@ -29,7 +34,10 @@ defmodule Pleroma.Activity.Search do
     |> maybe_restrict_local(user)
     |> maybe_restrict_author(author)
     |> maybe_restrict_blocked(user)
-    |> Pagination.fetch_paginated(%{"offset" => offset, "limit" => limit}, :offset)
+    |> Pagination.fetch_paginated(
+      %{"offset" => offset, "limit" => limit, "skip_order" => index_type == :rum},
+      :offset
+    )
     |> maybe_fetch(user, search_query)
   end