summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorGenericMale <genericmale00@gmail.com>2024-08-22 19:14:24 +0200
committerBnyro <bnyro@tutanota.com>2024-09-03 17:49:33 +0200
commite65edb141d4c5ac7811a77874390492be1872a9b (patch)
tree71342c19a7e26d627099f11008d49cef991cc186 /searx/webapp.py
parentb09aa7e36038307703fdc22cc352920a4d6b9366 (diff)
[feat] results: show response times
Diffstat (limited to 'searx/webapp.py')
-rwxr-xr-xsearx/webapp.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 4ecc9559e..dd79defcb 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -761,6 +761,11 @@ def search():
)
)
+ # engine_timings: get engine response times sorted from slowest to fastest
+ engine_timings = sorted(result_container.get_timings(), reverse=True, key=lambda e: e.total)
+ max_response_time = engine_timings[0].total if engine_timings else None
+ engine_timings_pairs = [(timing.engine, timing.total) for timing in engine_timings]
+
# search_query.lang contains the user choice (all, auto, en, ...)
# when the user choice is "auto", search.search_query.lang contains the detected language
# otherwise it is equals to search_query.lang
@@ -789,7 +794,9 @@ def search():
settings['search']['languages'],
fallback=request.preferences.get_value("language")
),
- timeout_limit = request.form.get('timeout_limit', None)
+ timeout_limit = request.form.get('timeout_limit', None),
+ timings = engine_timings_pairs,
+ max_response_time = max_response_time
# fmt: on
)