meilisearch: Move published date to lower priority

Currently, Akkoma sorts by published date first before everything else.
This however makes search results pretty bad since Meilisearch uses a
bucket sort algorithm in order of the ranking rules specified:
https://www.meilisearch.com/docs/learn/core_concepts/relevancy#behavior

Since the `published` attribute is a unix timestamp, the resulting
buckets are pretty small so the other rules essentially have little to
no effect on the rankings of search results.

This fixes that issue by moving the `published:desc` rule further down
so it still sorts by date, but only after considering everything else.

AFAIK attribute and sort doesn't really affect results for Akkoma since
the only attribute considered is the `content` attribute and the `sort`
parameter isn't used in Akkoma searches. Everything else is made to
match more closely to Meilisearch's defaults.
This commit is contained in:
Norm 2023-08-11 11:07:14 -04:00
parent 7bd4ae5412
commit d79c92f9c6
Signed by untrusted user: norm
GPG key ID: 41288320096BE045

View file

@ -30,12 +30,12 @@ def run(["index"]) do
meili_put( meili_put(
"/indexes/objects/settings/ranking-rules", "/indexes/objects/settings/ranking-rules",
[ [
"published:desc",
"words", "words",
"exactness",
"proximity", "proximity",
"typo", "typo",
"exactness",
"attribute", "attribute",
"published:desc",
"sort" "sort"
] ]
) )