mirror of
https://github.com/searxng/searxng.git
synced 2024-11-26 04:41:00 +00:00
[feat] results: show response times
This commit is contained in:
parent
b09aa7e360
commit
e65edb141d
4 changed files with 50 additions and 24 deletions
|
@ -748,6 +748,20 @@ summary.title {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#engines_msg {
|
||||||
|
.engine-name {
|
||||||
|
width: 10rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.response-error {
|
||||||
|
color: var(--color-error);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar-chart-value {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#search_url {
|
#search_url {
|
||||||
div.selectable_url {
|
div.selectable_url {
|
||||||
pre {
|
pre {
|
||||||
|
|
|
@ -1,27 +1,34 @@
|
||||||
<div id="engines_msg">
|
<div id="engines_msg">
|
||||||
{% if not results and not answers %}
|
{% if not results and not answers %}
|
||||||
<details class="sidebar-collapsable" open>
|
<details class="sidebar-collapsable" open>
|
||||||
|
<summary class="title" id="engines_msg-title">{{ _('Messages from the search engines') }}</summary>
|
||||||
{% else %}
|
{% else %}
|
||||||
<details class="sidebar-collapsable">
|
<details class="sidebar-collapsable">
|
||||||
|
<summary class="title" id="engines_msg-title">{{ _('Response time') }}: {{ max_response_time | round(1) }} {{ _('seconds') }}</summary>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<summary class="title" id="engines_msg-title">{{ _('Messages from the search engines') }}</summary>
|
<table class="engine-stats" id="engines_msg-table">
|
||||||
<div class="dialog-error" role="alert">
|
{%- for engine_name, error_type in unresponsive_engines -%}
|
||||||
{{ icon_big('warning') }}
|
<tr>
|
||||||
<div>
|
<td class="engine-name">
|
||||||
<p>
|
<a href="{{ url_for('stats', engine=engine_name|e) }}"
|
||||||
<strong>{{ _('Error!') }}</strong>
|
title="{{ _('View error logs and submit a bug report') }}">
|
||||||
{{ _('Engines cannot retrieve results') }}:
|
{{- engine_name -}}
|
||||||
</p>
|
</a>
|
||||||
{%- for engine_name, error_type in unresponsive_engines -%}
|
</td>
|
||||||
<p>{{- engine_name }} (
|
<td class="response-error">{{- error_type -}}</td>
|
||||||
<a href="{{ url_for('stats', engine=engine_name|e) }}"
|
</tr>
|
||||||
title="{{ _('View error logs and submit a bug report') }}">
|
{%- endfor -%}
|
||||||
{{- error_type -}}
|
{%- for engine_name, response_time in timings -%}
|
||||||
</a>
|
<tr>
|
||||||
){{- '' -}}
|
<td class="engine-name"><a href="{{ url_for('stats', engine=engine_name|e) }}">{{ engine_name }}</a></td>
|
||||||
</p>
|
<td class="response-time">
|
||||||
{%- endfor -%}
|
<div class="bar-chart-value">{{- response_time | round(1) -}}</div>
|
||||||
</div>
|
<div class="bar-chart-graph" aria-labelledby="{{engine_name}}_time" aria-hidden="true">
|
||||||
</div>
|
<div class="bar-chart-bar bar{{ (100 * response_time / max_response_time) | round | int }}"></div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{%- endfor -%}
|
||||||
|
</table>
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -57,14 +57,12 @@
|
||||||
{%- include 'simple/elements/suggestions.html' -%}
|
{%- include 'simple/elements/suggestions.html' -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- include 'simple/elements/engines_msg.html' -%}
|
||||||
|
|
||||||
{%- if method == 'POST' -%}
|
{%- if method == 'POST' -%}
|
||||||
{%- include 'simple/elements/search_url.html' -%}
|
{%- include 'simple/elements/search_url.html' -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
{%- if unresponsive_engines -%}
|
|
||||||
{%- include 'simple/elements/engines_msg.html' -%}
|
|
||||||
{%- endif -%}
|
|
||||||
|
|
||||||
{%- if search_formats -%}
|
{%- if search_formats -%}
|
||||||
{%- include 'simple/elements/apis.html' -%}
|
{%- include 'simple/elements/apis.html' -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
|
@ -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, ...)
|
# search_query.lang contains the user choice (all, auto, en, ...)
|
||||||
# when the user choice is "auto", search.search_query.lang contains the detected language
|
# when the user choice is "auto", search.search_query.lang contains the detected language
|
||||||
# otherwise it is equals to search_query.lang
|
# otherwise it is equals to search_query.lang
|
||||||
|
@ -789,7 +794,9 @@ def search():
|
||||||
settings['search']['languages'],
|
settings['search']['languages'],
|
||||||
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),
|
||||||
|
timings = engine_timings_pairs,
|
||||||
|
max_response_time = max_response_time
|
||||||
# fmt: on
|
# fmt: on
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue