mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
feat: Improve search engines loading time info
This commit is contained in:
parent
d4dfec3f3e
commit
89909f06af
2 changed files with 15 additions and 14 deletions
|
@ -35,21 +35,16 @@
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
|
|
||||||
{%- if number_of_results != '0' -%}
|
{%- if number_of_results != '0' -%}
|
||||||
<p id="result_count">
|
|
||||||
<small>{{ _('Number of results') }}: {{ number_of_results }}</small>
|
|
||||||
</p>
|
|
||||||
<details>
|
<details>
|
||||||
<summary>
|
<summary>
|
||||||
<small>Longest loading time: {{ longest_loading_time.load }} from {{ longest_loading_time.engine }}</small>
|
<small id="result_count">{{ _('Number of results') }}: {{ number_of_results }}</small>
|
||||||
|
<small>{{ longest_load_time_formatted }}</small>
|
||||||
</summary>
|
</summary>
|
||||||
<div>
|
<ul>
|
||||||
<ul>
|
{% for engine, timing in loading_times %}
|
||||||
{% for timing in loading_times %}
|
<li>{{ engine }}: {{ timing }}</li>
|
||||||
<li>
|
{% endfor %}
|
||||||
<small>{{ timing.load }} from {{ timing.engine }}</small>
|
</ul>
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</details>
|
</details>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
|
|
|
@ -794,8 +794,14 @@ def search():
|
||||||
fallback=request.preferences.get_value("language")
|
fallback=request.preferences.get_value("language")
|
||||||
),
|
),
|
||||||
timeout_limit = request.form.get('timeout_limit', None),
|
timeout_limit = request.form.get('timeout_limit', None),
|
||||||
longest_loading_time = longest_loading_time,
|
longest_load_time_formatted = gettext("Took {seconds} second(s)")
|
||||||
loading_times = timings,
|
.format(seconds="{:.2f}".format(longest_loading_time[1])),
|
||||||
|
# List of tuples of (engine, load time); Displayed in the sidebar
|
||||||
|
# Sorted by load time, descending
|
||||||
|
loading_times = sorted((
|
||||||
|
(timing.engine, "{:.2f}".format(timing.load))
|
||||||
|
for timing in timings
|
||||||
|
), key=lambda x: x[1], reverse=True),
|
||||||
# fmt: on
|
# fmt: on
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue