2019-12-08 22:16:13 -05:00
|
|
|
defmodule Mix.Tasks.ReindexAll do
|
|
|
|
use Mix.Task
|
|
|
|
|
2024-12-08 21:11:41 -05:00
|
|
|
alias Philomena.SearchIndexer
|
2021-04-01 11:16:47 -04:00
|
|
|
|
2024-05-25 14:03:45 -04:00
|
|
|
@shortdoc "Destroys and recreates all OpenSearch indices."
|
2020-10-26 17:01:29 -04:00
|
|
|
@requirements ["app.start"]
|
2020-08-07 20:23:36 -04: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-08 22:16:13 -05:00
|
|
|
end
|
|
|
|
|
2025-01-11 17:31:05 -05:00
|
|
|
SearchIndexer.recreate_reindex_all_destructive!(maintenance: false)
|
2019-12-08 22:16:13 -05:00
|
|
|
end
|
2019-12-24 16:14:42 -05:00
|
|
|
end
|