Mark only content as searchable for meilisearch
This commit is contained in:
parent
2b2e409ad7
commit
9f16ca80e0
|
@ -28,6 +28,14 @@ def run(["index"]) do
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
|
|
||||||
|
{:ok, _} =
|
||||||
|
Pleroma.HTTP.post(
|
||||||
|
"#{endpoint}/indexes/objects/settings/searchable-attributes",
|
||||||
|
Jason.encode!([
|
||||||
|
"content"
|
||||||
|
])
|
||||||
|
)
|
||||||
|
|
||||||
chunk_size = 10_000
|
chunk_size = 10_000
|
||||||
|
|
||||||
Pleroma.Repo.transaction(
|
Pleroma.Repo.transaction(
|
||||||
|
@ -55,8 +63,14 @@ def run(["index"]) do
|
||||||
Enum.map(objects, fn object ->
|
Enum.map(objects, fn object ->
|
||||||
data = object.data
|
data = object.data
|
||||||
|
|
||||||
|
content_str =
|
||||||
|
case data["content"] do
|
||||||
|
[nil | rest] -> to_string(rest)
|
||||||
|
str -> str
|
||||||
|
end
|
||||||
|
|
||||||
{:ok, published, _} = DateTime.from_iso8601(data["published"])
|
{:ok, published, _} = DateTime.from_iso8601(data["published"])
|
||||||
{:ok, content} = FastSanitize.strip_tags(data["content"])
|
{:ok, content} = FastSanitize.strip_tags(content_str)
|
||||||
|
|
||||||
%{
|
%{
|
||||||
id: object.id,
|
id: object.id,
|
||||||
|
|
Loading…
Reference in New Issue