From c9f9ec04c8b7c24b47acb3f5a00f596b699c2c82 Mon Sep 17 00:00:00 2001 From: Mint Date: Thu, 21 Nov 2024 02:13:10 +0300 Subject: [PATCH 1/6] Meilisearch: use PUT method for indexing Mix task See https://github.com/meilisearch/meilisearch/issues/2619 --- lib/mix/tasks/pleroma/search/meilisearch.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mix/tasks/pleroma/search/meilisearch.ex b/lib/mix/tasks/pleroma/search/meilisearch.ex index 8379a0c252..389b8a564c 100644 --- a/lib/mix/tasks/pleroma/search/meilisearch.ex +++ b/lib/mix/tasks/pleroma/search/meilisearch.ex @@ -28,7 +28,7 @@ def run(["index"]) do end {:ok, _} = - meili_post( + meili_put( "/indexes/objects/settings/ranking-rules", [ "published:desc", @@ -42,7 +42,7 @@ def run(["index"]) do ) {:ok, _} = - meili_post( + meili_put( "/indexes/objects/settings/searchable-attributes", [ "content" From d65f768b59649de5ed5e76d7dd8248c76fd81a9f Mon Sep 17 00:00:00 2001 From: Mint Date: Thu, 21 Nov 2024 02:14:55 +0300 Subject: [PATCH 2/6] Meilisearch: stop attempting to index posts with nil date --- lib/pleroma/search/meilisearch.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/pleroma/search/meilisearch.ex b/lib/pleroma/search/meilisearch.ex index 9bba5b30f8..cafae80990 100644 --- a/lib/pleroma/search/meilisearch.ex +++ b/lib/pleroma/search/meilisearch.ex @@ -122,6 +122,7 @@ def object_to_search_data(object) do # Only index public or unlisted Notes if not is_nil(object) and object.data["type"] == "Note" and not is_nil(object.data["content"]) and + not is_nil(object.data["published"]) and (Pleroma.Constants.as_public() in object.data["to"] or Pleroma.Constants.as_public() in object.data["cc"]) and object.data["content"] not in ["", "."] do From 3a82a51a6e8b25c2e58e75329e12a090ad977519 Mon Sep 17 00:00:00 2001 From: Mint Date: Thu, 21 Nov 2024 02:16:36 +0300 Subject: [PATCH 3/6] Docs: fix OTP mix task command for Meilisearch --- docs/configuration/search.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/configuration/search.md b/docs/configuration/search.md index d34f84d4f9..de1a722030 100644 --- a/docs/configuration/search.md +++ b/docs/configuration/search.md @@ -73,7 +73,7 @@ you have to get the _private key_, which is actually used for authentication. === "OTP" ```sh - ./bin/pleroma_ctl search.meilisearch show-keys + ./bin/pleroma_ctl meilisearch show-keys ``` === "From Source" @@ -103,7 +103,7 @@ To start the initial indexing, run the `index` command: === "OTP" ```sh - ./bin/pleroma_ctl search.meilisearch index + ./bin/pleroma_ctl meilisearch index ``` === "From Source" @@ -118,7 +118,7 @@ of indexing and how many posts have actually been indexed, use the `stats` comma === "OTP" ```sh - ./bin/pleroma_ctl search.meilisearch stats + ./bin/pleroma_ctl meilisearch stats ``` === "From Source" @@ -133,7 +133,7 @@ use the `clear` command: === "OTP" ```sh - ./bin/pleroma_ctl search.meilisearch clear + ./bin/pleroma_ctl meilisearch clear ``` === "From Source" From af7de4c17a0f146a3048d5b2742a292e69bbbb70 Mon Sep 17 00:00:00 2001 From: Mint Date: Thu, 21 Nov 2024 02:17:53 +0300 Subject: [PATCH 4/6] Changelog --- changelog.d/meilisearch-misc-fixes.fix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/meilisearch-misc-fixes.fix diff --git a/changelog.d/meilisearch-misc-fixes.fix b/changelog.d/meilisearch-misc-fixes.fix new file mode 100644 index 0000000000..0f127d3a8d --- /dev/null +++ b/changelog.d/meilisearch-misc-fixes.fix @@ -0,0 +1 @@ +Miscellaneous fixes for Meilisearch support From da7132caba49777c25413efc8adc90d27576b07f Mon Sep 17 00:00:00 2001 From: Mint Date: Thu, 21 Nov 2024 02:40:27 +0300 Subject: [PATCH 5/6] Remove unused import --- lib/mix/tasks/pleroma/search/meilisearch.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mix/tasks/pleroma/search/meilisearch.ex b/lib/mix/tasks/pleroma/search/meilisearch.ex index 389b8a564c..edce9e8717 100644 --- a/lib/mix/tasks/pleroma/search/meilisearch.ex +++ b/lib/mix/tasks/pleroma/search/meilisearch.ex @@ -9,7 +9,7 @@ defmodule Mix.Tasks.Pleroma.Search.Meilisearch do import Ecto.Query import Pleroma.Search.Meilisearch, - only: [meili_post: 2, meili_put: 2, meili_get: 1, meili_delete: 1] + only: [meili_put: 2, meili_get: 1, meili_delete: 1] def run(["index"]) do start_pleroma() From 462a6a2000d10e3b6047bc72143ff239caf40186 Mon Sep 17 00:00:00 2001 From: Mint Date: Thu, 21 Nov 2024 16:52:30 +0300 Subject: [PATCH 6/6] Revert "Docs: fix OTP mix task command for Meilisearch" This reverts commit 3a82a51a6e8b25c2e58e75329e12a090ad977519. --- docs/configuration/search.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/configuration/search.md b/docs/configuration/search.md index de1a722030..d34f84d4f9 100644 --- a/docs/configuration/search.md +++ b/docs/configuration/search.md @@ -73,7 +73,7 @@ you have to get the _private key_, which is actually used for authentication. === "OTP" ```sh - ./bin/pleroma_ctl meilisearch show-keys + ./bin/pleroma_ctl search.meilisearch show-keys ``` === "From Source" @@ -103,7 +103,7 @@ To start the initial indexing, run the `index` command: === "OTP" ```sh - ./bin/pleroma_ctl meilisearch index + ./bin/pleroma_ctl search.meilisearch index ``` === "From Source" @@ -118,7 +118,7 @@ of indexing and how many posts have actually been indexed, use the `stats` comma === "OTP" ```sh - ./bin/pleroma_ctl meilisearch stats + ./bin/pleroma_ctl search.meilisearch stats ``` === "From Source" @@ -133,7 +133,7 @@ use the `clear` command: === "OTP" ```sh - ./bin/pleroma_ctl meilisearch clear + ./bin/pleroma_ctl search.meilisearch clear ``` === "From Source"