Skip to content

SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.

[feat] s1search: parse suggestions (#6810)

Bnyro7a3e41d420b5
diff --git a/searx/engines/s1search_rampjs.py b/searx/engines/s1search_rampjs.py
index 10478f2c0..160605884 100644
--- a/searx/engines/s1search_rampjs.py
+++ b/searx/engines/s1search_rampjs.py
@@ -48,16 +48,21 @@ def response(resp: "SXNG_Response") -> EngineResults:
mainline = [s for s in data["search"]["regions"] if s["name"] == "mainline"][0]
for group in mainline["groups"]:
- for result in group["results"]:
- if not ("url" in result or "clickUrl" in result):
- continue
-
- res.add(
- res.types.MainResult(
- url=result.get("url") or result.get("clickUrl"),
- title=html_to_text(result["title"]),
- content=html_to_text(result["description"]),
- )
- )
+ match group["result_type"]:
+ case "web":
+ for result in group["results"]:
+ res.add(
+ res.types.MainResult(
+ url=result.get("url") or result.get("clickUrl"),
+ title=html_to_text(result["title"]),
+ content=html_to_text(result["description"]),
+ )
+ )
+ case "aylf":
+ for result in group["results"]:
+ res.add(res.types.LegacyResult(suggestion=result["term"]))
+
+ case _:
+ pass
return res