From 87165ac5322ab87a8b5bfded2c749a79b4958dca Mon Sep 17 00:00:00 2001 From: Daniel Kukula Date: Thu, 16 May 2024 20:44:34 +0100 Subject: [PATCH] [mod] engine hex: add sort_criteria & page_size to configuration --- searx/engines/hex.py | 5 ++++- searx/settings.yml | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/searx/engines/hex.py b/searx/engines/hex.py index 2c1036f4d..4c4920f68 100644 --- a/searx/engines/hex.py +++ b/searx/engines/hex.py @@ -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 diff --git a/searx/settings.yml b/searx/settings.yml index 65c4966d4..78279d725 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -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