diff options
author | Lain Soykaf <lain@lain.com> | 2024-05-18 14:04:32 +0400 |
---|---|---|
committer | Lain Soykaf <lain@lain.com> | 2024-05-18 14:04:32 +0400 |
commit | e3933a067feae1f087616f675657d6ff99b2782b (patch) | |
tree | fc1e2d6455dfc760c6a8fcbc65586efb84613232 /lib | |
parent | 933117785fb1b5b671c61d09671cf6418b105187 (diff) | |
download | pleroma-e3933a067feae1f087616f675657d6ff99b2782b.tar.gz pleroma-e3933a067feae1f087616f675657d6ff99b2782b.zip |
QdrantSearch: Implement post deletion
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/search/qdrant_search.ex | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/pleroma/search/qdrant_search.ex b/lib/pleroma/search/qdrant_search.ex index 2d9315a2f..acfaaff52 100644 --- a/lib/pleroma/search/qdrant_search.ex +++ b/lib/pleroma/search/qdrant_search.ex @@ -82,6 +82,19 @@ defmodule Pleroma.Search.QdrantSearch do end @impl true + def remove_from_index(object) do + activity = Activity.get_by_object_ap_id_with_object(object.data["id"]) + id = activity.id |> FlakeId.from_string() |> Ecto.UUID.cast!() + + with {:ok, %{status: 200}} <- + QdrantClient.post("/collections/posts/points/delete", %{"points" => [id]}) do + :ok + else + e -> {:error, e} + end + end + + @impl true def search(_user, query, _options) do query = "Represent this sentence for searching relevant passages: #{query}" @@ -103,11 +116,6 @@ defmodule Pleroma.Search.QdrantSearch do [] end end - - @impl true - def remove_from_index(_object) do - :ok - end end defmodule Pleroma.Search.QdrantSearch.OllamaClient do |