From 5dd908552cacb93d3622ff176499f24c96ff5431 Mon Sep 17 00:00:00 2001 From: Ekaterina Vaartis Date: Sun, 14 Nov 2021 20:24:05 +0300 Subject: [PATCH] Move the search.ex file so credo doesn't complain --- lib/pleroma/search.ex | 24 +++++++++++++++--------- lib/pleroma/search/search.ex | 18 ------------------ 2 files changed, 15 insertions(+), 27 deletions(-) delete mode 100644 lib/pleroma/search/search.ex diff --git a/lib/pleroma/search.ex b/lib/pleroma/search.ex index 99bce632c..e363abf19 100644 --- a/lib/pleroma/search.ex +++ b/lib/pleroma/search.ex @@ -1,12 +1,18 @@ defmodule Pleroma.Search do - @type search_map :: %{ - statuses: [map], - accounts: [map], - hashtags: [map] - } + def add_to_index(activity) do + search_module = Pleroma.Config.get([Pleroma.Search, :module]) - @doc """ - Searches for stuff - """ - @callback search(map, map, keyword) :: search_map + ConcurrentLimiter.limit(Pleroma.Search, fn -> + Task.start(fn -> search_module.add_to_index(activity) end) + end) + end + + def remove_from_index(object) do + # Also delete from search index + search_module = Pleroma.Config.get([Pleroma.Search, :module]) + + ConcurrentLimiter.limit(Pleroma.Search, fn -> + Task.start(fn -> search_module.remove_from_index(object) end) + end) + end end diff --git a/lib/pleroma/search/search.ex b/lib/pleroma/search/search.ex deleted file mode 100644 index e363abf19..000000000 --- a/lib/pleroma/search/search.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule Pleroma.Search do - def add_to_index(activity) do - search_module = Pleroma.Config.get([Pleroma.Search, :module]) - - ConcurrentLimiter.limit(Pleroma.Search, fn -> - Task.start(fn -> search_module.add_to_index(activity) end) - end) - end - - def remove_from_index(object) do - # Also delete from search index - search_module = Pleroma.Config.get([Pleroma.Search, :module]) - - ConcurrentLimiter.limit(Pleroma.Search, fn -> - Task.start(fn -> search_module.remove_from_index(object) end) - end) - end -end -- 2.45.2