-defmodule Pleroma.Search do
+defmodule Pleroma.Search.DatabaseSearch do
def add_to_index(activity) do
search_module = Pleroma.Config.get([Pleroma.Search, :module])
Task.start(fn -> search_module.remove_from_index(object) end)
end)
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
end
end)
# Add local posts to search index
- if local, do: Pleroma.Search.add_to_index(activity)
+ if local, do: Pleroma.Search.DatabaseSearch.add_to_index(activity)
{:ok, activity}
else
Task.start(fn -> Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity) end)
end)
- Pleroma.Search.add_to_index(Map.put(activity, :object, object))
+ Pleroma.Search.DatabaseSearch.add_to_index(Map.put(activity, :object, object))
meta =
meta
if result == :ok do
Notification.create_notifications(object)
- Pleroma.Search.remove_from_index(deleted_object)
+ Pleroma.Search.DatabaseSearch.remove_from_index(deleted_object)
{:ok, object, meta}
else
end
defp resource_search(_, "statuses", query, options) do
- search_module = Pleroma.Config.get([Pleroma.Search, :module], Pleroma.Activity)
-
- statuses = with_fallback(fn -> search_module.search(options[:for_user], query, options) end)
+ statuses = with_fallback(fn -> Pleroma.Search.DatabaseSearch.search(query, options) end)
StatusView.render("index.json",
activities: statuses,