import Ecto.Query
+ @behaviour Pleroma.Search.SearchBackend
+
def search(user, search_query, options \\ []) do
index_type = if Pleroma.Config.get([:database, :rum_enabled]), do: :rum, else: :gin
limit = Enum.min([Keyword.get(options, :limit), 40])
end
end
+ @impl true
def add_to_index(_activity), do: nil
+
+ @impl true
def remove_from_index(_object), do: nil
def maybe_restrict_author(query, %User{} = author) do
import Pleroma.Search.DatabaseSearch
import Ecto.Query
+ @behaviour Pleroma.Search.SearchBackend
+
defp meili_headers do
private_key = Pleroma.Config.get([Pleroma.Search.Meilisearch, :private_key])
end
end
+ @impl true
def add_to_index(activity) do
maybe_search_data = object_to_search_data(activity.object)
end
end
+ @impl true
def remove_from_index(object) do
meili_delete!("/indexes/objects/documents/#{object.id}")
end
--- /dev/null
+defmodule Pleroma.Search.SearchBackend do
+ @doc """
+ Add the object associated with the activity to the search index.
+
+ The whole activity is passed, to allow filtering on things such as scope.
+ """
+ @callback add_to_index(activity :: Pleroma.Activity.t()) :: nil
+
+ @doc """
+ Remove the object from the index.
+
+ Just the object, as opposed to the whole activity, is passed, since the object
+ is what contains the actual content and there is no need for fitlering when removing
+ from index.
+ """
+ @callback remove_from_index(object :: Pleroma.Object.t()) :: nil
+end