SearchBackend: Add drop_index

This commit is contained in:
Lain Soykaf 2024-05-16 10:47:24 +04:00
commit a9be4907c0
5 changed files with 45 additions and 4 deletions

View file

@ -9,9 +9,23 @@ defmodule Mix.Tasks.Pleroma.Search.Indexer do
alias Pleroma.Workers.SearchIndexingWorker
def run(["create_index"]) do
Application.ensure_all_started(:pleroma)
start_pleroma()
Pleroma.Config.get([Pleroma.Search, :module]).create_index()
with :ok <- Pleroma.Config.get([Pleroma.Search, :module]).create_index() do
IO.puts("Index created")
else
e -> IO.puts("Could not create index: #{inspect(e)}")
end
end
def run(["drop_index"]) do
start_pleroma()
with :ok <- Pleroma.Config.get([Pleroma.Search, :module]).drop_index() do
IO.puts("Index dropped")
else
e -> IO.puts("Could not drop index: #{inspect(e)}")
end
end
def run(["index" | options]) do