From 59685e25d216c682815c8f7ccf10d577f2c735fb Mon Sep 17 00:00:00 2001 From: Oneric Date: Wed, 15 May 2024 06:46:47 +0200 Subject: [PATCH] meilisearch: show keys by name not description MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes show-key’s output match our documentation as of Meilisearch 1.8.0-8-g4d5971f343c00d45c11ef0cfb6f61e83a8508208. Since I’m not sure if older versions maybe only provided description, it will fallback to the latter if no name parameter exists. --- lib/mix/tasks/pleroma/search/meilisearch.ex | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/mix/tasks/pleroma/search/meilisearch.ex b/lib/mix/tasks/pleroma/search/meilisearch.ex index 299fb5b14..e4dc616b4 100644 --- a/lib/mix/tasks/pleroma/search/meilisearch.ex +++ b/lib/mix/tasks/pleroma/search/meilisearch.ex @@ -126,8 +126,12 @@ defmodule Mix.Tasks.Pleroma.Search.Meilisearch do decoded = Jason.decode!(result.body) if decoded["results"] do - Enum.each(decoded["results"], fn %{"description" => desc, "key" => key} -> - IO.puts("#{desc}: #{key}") + Enum.each(decoded["results"], fn + %{"name" => name, "key" => key} -> + IO.puts("#{name}: #{key}") + + %{"description" => desc, "key" => key} -> + IO.puts("#{desc}: #{key}") end) else IO.puts("Error fetching the keys, check the master key is correct: #{inspect(decoded)}")