summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEkaterina Vaartis <vaartis@kotobank.ch>2021-11-13 15:07:51 +0300
committerEkaterina Vaartis <vaartis@kotobank.ch>2022-10-10 20:19:09 +0300
commit9c1a9307079c8d007ae7cbf3e089d2bc5ea6b733 (patch)
tree72d74c06131626c589e4ed6c9fbea0f585debceb
parente928e307f34542b0a0af8b615c986aeac478b637 (diff)
downloadpleroma-9c1a9307079c8d007ae7cbf3e089d2bc5ea6b733.tar.gz
pleroma-9c1a9307079c8d007ae7cbf3e089d2bc5ea6b733.zip
Support reindexing meilisearch >=0.24.0
It has has a different error code key
-rw-r--r--lib/mix/tasks/pleroma/search/meilisearch.ex8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/mix/tasks/pleroma/search/meilisearch.ex b/lib/mix/tasks/pleroma/search/meilisearch.ex
index 2a3c3a8b9..3b134ad3f 100644
--- a/lib/mix/tasks/pleroma/search/meilisearch.ex
+++ b/lib/mix/tasks/pleroma/search/meilisearch.ex
@@ -76,8 +76,14 @@ defmodule Mix.Tasks.Pleroma.Search.Meilisearch do
if is_reindex do
result = meili_get!("/indexes/objects/documents/#{o.id}")
+ # With >= 0.24.0 the name for "errorCode" is just "code"
+ error_code_key =
+ if meili_get!("/version")["pkgVersion"] |> Version.match?(">= 0.24.0"),
+ do: "code",
+ else: "errorCode"
+
# Filter out the already indexed documents. This is true when the document does not exist
- result["errorCode"] == "document_not_found"
+ result[error_code_key] == "document_not_found"
else
true
end