QdrantSearch: Implement post deletion
This commit is contained in:
parent
933117785f
commit
e3933a067f
2 changed files with 27 additions and 7 deletions
|
|
@ -81,6 +81,19 @@ defmodule Pleroma.Search.QdrantSearch do
|
|||
end
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue