2021-12-20 19:38:50 +00:00
|
|
|
defmodule Pleroma.Search.SearchBackend do
|
2022-08-26 21:19:08 +00:00
|
|
|
@doc """
|
|
|
|
Search statuses with a query, restricting to only those the user should have access to.
|
|
|
|
"""
|
|
|
|
@callback search(user :: Pleroma.User.t(), query :: String.t(), options :: [any()]) :: [
|
|
|
|
Pleroma.Activity.t()
|
|
|
|
]
|
|
|
|
|
2021-12-20 19:38:50 +00:00
|
|
|
@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.
|
|
|
|
"""
|
2022-08-26 21:19:08 +00:00
|
|
|
@callback add_to_index(activity :: Pleroma.Activity.t()) :: :ok | {:error, any()}
|
2021-12-20 19:38:50 +00:00
|
|
|
|
|
|
|
@doc """
|
|
|
|
Remove the object from the index.
|
|
|
|
|
|
|
|
Just the object, as opposed to the whole activity, is passed, since the object
|
2023-12-27 23:15:32 +00:00
|
|
|
is what contains the actual content and there is no need for filtering when removing
|
2021-12-20 19:38:50 +00:00
|
|
|
from index.
|
|
|
|
"""
|
2024-01-27 00:26:11 +00:00
|
|
|
@callback remove_from_index(object :: Pleroma.Object.t()) :: :ok | {:error, any()}
|
2024-05-14 13:19:36 +00:00
|
|
|
|
|
|
|
@doc """
|
|
|
|
Create the index
|
|
|
|
"""
|
|
|
|
@callback create_index() :: :ok | {:error, any()}
|
2021-12-20 19:38:50 +00:00
|
|
|
end
|