Merge branch 'fixes' into 'main'
fix(search): fix global search sorting Closes #1297 See merge request framasoft/mobilizon!1404
This commit is contained in:
commit
b69ffacff5
|
@ -52,7 +52,7 @@ defmodule Mobilizon.Service.GlobalSearch.SearchMobilizon do
|
||||||
start: (Keyword.get(options, :page, 1) - 1) * Keyword.get(options, :limit, 16),
|
start: (Keyword.get(options, :page, 1) - 1) * Keyword.get(options, :limit, 16),
|
||||||
latlon: to_lat_lon(options[:location]),
|
latlon: to_lat_lon(options[:location]),
|
||||||
bbox: options[:bbox],
|
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]
|
boostLanguages: options[:boost_languages]
|
||||||
)
|
)
|
||||||
|> Keyword.take([
|
|> Keyword.take([
|
||||||
|
@ -68,8 +68,7 @@ defmodule Mobilizon.Service.GlobalSearch.SearchMobilizon do
|
||||||
:statusOneOf,
|
:statusOneOf,
|
||||||
:bbox,
|
:bbox,
|
||||||
:start,
|
:start,
|
||||||
:count,
|
:count
|
||||||
:sortBy
|
|
||||||
])
|
])
|
||||||
|> Keyword.reject(fn {_key, val} -> is_nil(val) or val == "" end)
|
|> 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],
|
start: (options[:page] - 1) * options[:limit],
|
||||||
latlon: to_lat_lon(options[:location]),
|
latlon: to_lat_lon(options[:location]),
|
||||||
bbox: options[:bbox],
|
bbox: options[:bbox],
|
||||||
sortBy: Map.get(@sort_by_options, options[:sort_by])
|
sort: Map.get(@sort_by_options, options[:sort_by])
|
||||||
)
|
)
|
||||||
|> Keyword.take([
|
|> Keyword.take([
|
||||||
:search,
|
:search,
|
||||||
|
@ -115,8 +114,7 @@ defmodule Mobilizon.Service.GlobalSearch.SearchMobilizon do
|
||||||
:sort,
|
:sort,
|
||||||
:start,
|
:start,
|
||||||
:count,
|
:count,
|
||||||
:bbox,
|
:bbox
|
||||||
:sortBy
|
|
||||||
])
|
])
|
||||||
|> Keyword.reject(fn {_key, val} -> is_nil(val) or val == "" end)
|
|> Keyword.reject(fn {_key, val} -> is_nil(val) or val == "" end)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue