2021-11-17 19:29:49 +00:00
|
|
|
defmodule Pleroma.Search do
|
2022-01-22 12:23:11 +00:00
|
|
|
alias Pleroma.Workers.SearchIndexingWorker
|
2021-11-17 19:29:49 +00:00
|
|
|
|
2022-01-22 13:52:06 +00:00
|
|
|
def add_to_index(%Pleroma.Activity{id: activity_id}) do
|
|
|
|
SearchIndexingWorker.enqueue("add_to_index", %{"activity" => activity_id})
|
2021-11-17 19:29:49 +00:00
|
|
|
end
|
|
|
|
|
2022-01-22 13:52:06 +00:00
|
|
|
def remove_from_index(%Pleroma.Object{id: object_id}) do
|
|
|
|
SearchIndexingWorker.enqueue("remove_from_index", %{"object" => object_id})
|
2021-11-17 19:29:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def search(query, options) do
|
|
|
|
search_module = Pleroma.Config.get([Pleroma.Search, :module], Pleroma.Activity)
|
|
|
|
|
|
|
|
search_module.search(options[:for_user], query, options)
|
|
|
|
end
|
2024-05-25 18:20:47 +00:00
|
|
|
|
|
|
|
def healthcheck_endpoints do
|
|
|
|
search_module = Pleroma.Config.get([Pleroma.Search, :module], Pleroma.Activity)
|
|
|
|
search_module.healthcheck_endpoints
|
|
|
|
end
|
2021-11-17 19:29:49 +00:00
|
|
|
end
|