Make meilisearch sort on publish date converted to unix time
This commit is contained in:
parent
ea6a6a1287
commit
38996f551a
|
@ -18,7 +18,7 @@ def run(["index"]) do
|
||||||
Pleroma.HTTP.post(
|
Pleroma.HTTP.post(
|
||||||
"#{endpoint}/indexes/objects/settings/ranking-rules",
|
"#{endpoint}/indexes/objects/settings/ranking-rules",
|
||||||
Jason.encode!([
|
Jason.encode!([
|
||||||
"desc(id)",
|
"desc(published)",
|
||||||
"typo",
|
"typo",
|
||||||
"words",
|
"words",
|
||||||
"proximity",
|
"proximity",
|
||||||
|
@ -54,7 +54,15 @@ def run(["index"]) do
|
||||||
|> Stream.map(fn objects ->
|
|> Stream.map(fn objects ->
|
||||||
Enum.map(objects, fn object ->
|
Enum.map(objects, fn object ->
|
||||||
data = object.data
|
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)
|
||||||
end)
|
end)
|
||||||
|> Stream.each(fn objects ->
|
|> Stream.each(fn objects ->
|
||||||
|
|
Loading…
Reference in New Issue