fix(search): index remote attachment descriptions
This commit is contained in:
parent
271c3a3dd8
commit
13c944a04b
2 changed files with 8 additions and 0 deletions
|
|
@ -78,6 +78,7 @@ defmodule Pleroma.Search do
|
||||||
|
|
||||||
defp attachment_names(attachments) when is_list(attachments) do
|
defp attachment_names(attachments) when is_list(attachments) do
|
||||||
Enum.map(attachments, fn
|
Enum.map(attachments, fn
|
||||||
|
%{"summary" => summary} when is_binary(summary) -> summary
|
||||||
%{"name" => name} -> name
|
%{"name" => name} -> name
|
||||||
_ -> nil
|
_ -> nil
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,11 @@ defmodule Pleroma.SearchTest do
|
||||||
"summary" => "subject text",
|
"summary" => "subject text",
|
||||||
"attachment" => [
|
"attachment" => [
|
||||||
%{"type" => "Document", "name" => "image description"},
|
%{"type" => "Document", "name" => "image description"},
|
||||||
|
%{
|
||||||
|
"type" => "Document",
|
||||||
|
"name" => "remote-image.jpg",
|
||||||
|
"summary" => "remote image description"
|
||||||
|
},
|
||||||
%{"type" => "Document", "name" => ""}
|
%{"type" => "Document", "name" => ""}
|
||||||
],
|
],
|
||||||
"published" => DateTime.utc_now() |> DateTime.to_iso8601()
|
"published" => DateTime.utc_now() |> DateTime.to_iso8601()
|
||||||
|
|
@ -93,6 +98,8 @@ defmodule Pleroma.SearchTest do
|
||||||
assert content =~ "body text"
|
assert content =~ "body text"
|
||||||
assert content =~ "subject text"
|
assert content =~ "subject text"
|
||||||
assert content =~ "image description"
|
assert content =~ "image description"
|
||||||
|
assert content =~ "remote image description"
|
||||||
|
refute content =~ "remote-image.jpg"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "object_to_search_data ignores objects with invalid published dates" do
|
test "object_to_search_data ignores objects with invalid published dates" do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue