[mod] engine hex: add sort_criteria & page_size to configuration

This commit is contained in:
Daniel Kukula 2024-05-16 20:44:34 +01:00 committed by Markus Heiser
parent 75e4b65127
commit 87165ac532
2 changed files with 7 additions and 1 deletions

View file

@ -21,6 +21,9 @@ categories = ["it", "packages"]
# engine dependent config
paging = True
search_url = "https://hex.pm/api/packages/"
# Valid values: name inserted_at updated_at total_downloads recent_downloads
sort_criteria = "recent_downloads"
page_size = 10
linked_terms = {
# lower-case : replacement
@ -47,7 +50,7 @@ linked_terms = {
def request(query: str, params):
args = urlencode({"page": params["pageno"], "search": query})
args = urlencode({"page": params["pageno"], "per_page": page_size, "sort": sort_criteria, "search": query})
params["url"] = f"{search_url}?{args}"
return params

View file

@ -923,6 +923,9 @@ engines:
engine: hex
shortcut: hex
disabled: true
# Valid values: name inserted_at updated_at total_downloads recent_downloads
sort_criteria: "recent_downloads"
page_size: 10
- name: crates.io
engine: crates