fix(search): fix global search sorting

Closes #1297

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-06-01 16:11:12 +02:00
parent a6c77fe39e
commit 39e24c328a
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -52,7 +52,7 @@ defmodule Mobilizon.Service.GlobalSearch.SearchMobilizon do
start: (Keyword.get(options, :page, 1) - 1) * Keyword.get(options, :limit, 16),
latlon: to_lat_lon(options[:location]),
bbox: options[:bbox],
sortBy: Map.get(@sort_by_options, options[:sort_by]),
sort: Map.get(@sort_by_options, options[:sort_by]),
boostLanguages: options[:boost_languages]
)
|> Keyword.take([
@ -68,8 +68,7 @@ defmodule Mobilizon.Service.GlobalSearch.SearchMobilizon do
:statusOneOf,
:bbox,
:start,
:count,
:sortBy
:count
])
|> Keyword.reject(fn {_key, val} -> is_nil(val) or val == "" end)
@ -104,7 +103,7 @@ defmodule Mobilizon.Service.GlobalSearch.SearchMobilizon do
start: (options[:page] - 1) * options[:limit],
latlon: to_lat_lon(options[:location]),
bbox: options[:bbox],
sortBy: Map.get(@sort_by_options, options[:sort_by])
sort: Map.get(@sort_by_options, options[:sort_by])
)
|> Keyword.take([
:search,
@ -115,8 +114,7 @@ defmodule Mobilizon.Service.GlobalSearch.SearchMobilizon do
:sort,
:start,
:count,
:bbox,
:sortBy
:bbox
])
|> Keyword.reject(fn {_key, val} -> is_nil(val) or val == "" end)