mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 02:05:12 +00:00
Make meilisearch sort on publish date converted to unix time
This commit is contained in:
parent
abf82a63ec
commit
7b3701e6b9
|
@ -18,7 +18,7 @@ defmodule Mix.Tasks.Pleroma.Search.Meilisearch do
|
|||
Pleroma.HTTP.post(
|
||||
"#{endpoint}/indexes/objects/settings/ranking-rules",
|
||||
Jason.encode!([
|
||||
"desc(id)",
|
||||
"desc(published)",
|
||||
"typo",
|
||||
"words",
|
||||
"proximity",
|
||||
|
@ -54,7 +54,15 @@ defmodule Mix.Tasks.Pleroma.Search.Meilisearch do
|
|||
|> Stream.map(fn objects ->
|
||||
Enum.map(objects, fn object ->
|
||||
data = object.data
|
||||
%{id: object.id, source: data["source"], ap: data["id"]}
|
||||
|
||||
{:ok, published, _} = DateTime.from_iso8601(data["published"])
|
||||
|
||||
%{
|
||||
id: object.id,
|
||||
source: data["source"],
|
||||
ap: data["id"],
|
||||
published: published |> DateTime.to_unix()
|
||||
}
|
||||
end)
|
||||
end)
|
||||
|> Stream.each(fn objects ->
|
||||
|
|
Loading…
Reference in a new issue