2019-12-09 04:16:13 +01:00
|
|
|
defmodule Mix.Tasks.ReindexAll do
|
|
|
|
use Mix.Task
|
|
|
|
|
2024-12-09 03:11:41 +01:00
|
|
|
alias Philomena.SearchIndexer
|
2021-04-01 17:16:47 +02:00
|
|
|
|
2024-05-25 20:03:45 +02:00
|
|
|
@shortdoc "Destroys and recreates all OpenSearch indices."
|
2020-10-26 22:01:29 +01:00
|
|
|
@requirements ["app.start"]
|
2020-08-08 02:23:36 +02:00
|
|
|
@impl Mix.Task
|
|
|
|
def run(args) do
|
|
|
|
if Mix.env() == :prod and not Enum.member?(args, "--i-know-what-im-doing") do
|
|
|
|
raise "do not run this task unless you know what you're doing"
|
2019-12-09 04:16:13 +01:00
|
|
|
end
|
|
|
|
|
2024-12-09 03:11:41 +01:00
|
|
|
SearchIndexer.recreate_reindex_all_destructive!()
|
2019-12-09 04:16:13 +01:00
|
|
|
end
|
2019-12-24 22:14:42 +01:00
|
|
|
end
|