summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLain Soykaf <lain@lain.com>2024-05-18 14:04:32 +0400
committerLain Soykaf <lain@lain.com>2024-05-18 14:04:32 +0400
commite3933a067feae1f087616f675657d6ff99b2782b (patch)
treefc1e2d6455dfc760c6a8fcbc65586efb84613232 /lib
parent933117785fb1b5b671c61d09671cf6418b105187 (diff)
downloadpleroma-e3933a067feae1f087616f675657d6ff99b2782b.tar.gz
pleroma-e3933a067feae1f087616f675657d6ff99b2782b.zip
QdrantSearch: Implement post deletion
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/search/qdrant_search.ex18
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