@@ -31,14 +34,14 @@
{% for engine_stat in engine_stats.get('time', []) %}
- {{ engine_stat.name }} |
+ {{ engine_stat.name }} |
- {% if engine_stat.score %}
+ {%- if engine_stat.score -%}
{{ engine_stat.score|round(1) }}
{{- "" -}}
{{ _('Scores per result') }}: {{ engine_stat.score_per_result | round(3) }}
- {% endif %}
+ {%- endif -%}
|
{%- if engine_stat.result_count -%}
@@ -92,6 +95,63 @@
{% endif %}
+
+ {% if selected_engine_name %}
+ {% for secondary in [False, True] %}
+ {% set ns = namespace(first=true) %}
+ {% for error in engine_reliabilities[selected_engine_name].errors %}
+ {% if secondary == error.secondary %}
+ {% if ns.first %}
+ {% set ns.first = false %}
+ {% if secondary %}{{ _('Warnings') }}{% else %}{{ _('Errors and exceptions') }}{% endif %}
+ {% endif %}
+
+
+
+ {%- if error.exception_classname -%}
+ {{ _('Exception') }} | {{ error.exception_classname }} |
+ {%- elif error.log_message -%}
+ {{ _('Message') }} | {{ error.log_message }} |
+ {%- endif -%}
+ {{ _('Percentage') }} | {{ error.percentage }} |
+
+ {% if error.log_parameters and error.log_parameters != (None, None, None) %}{{ _('Parameter') }} | {{- '' -}}
+
+ {%- for param in error.log_parameters -%}
+ {{ param }}
+ {%- endfor -%}
+ |
+
+ {% endif %}
+ {{ _('Filename') }} | {{ error.filename }}:{{ error.line_no }} |
+ {{ _('Function') }} | {{ error.function }} |
+ {{ _('Code') }} | {{ error.code }} |
+
+
+ {% endif %}
+ {% endfor %}
+ {% endfor %}
+ {% if engine_reliabilities[selected_engine_name].checker %}
+ {{ _('Checker') }}
+
+
+ {{ _('Failed test') }} |
+ {{ _('Comment(s)') }} |
+
+ {% for test_name, results in engine_reliabilities[selected_engine_name].checker.items() %}
+
+ {{ test_name }} |
+
+ {% for r in results %} {{ r }} {% endfor %}
+ |
+
+ {% endfor %}
+
+ {% endif %}
+ {{ new_issue(brand.NEW_ISSUE_URL, selected_engine_name, engine_reliabilities[selected_engine_name]) }}
+ {% endif %}
+
+
{% endblock %}
diff --git a/searx/templates/simple/stats.html b/searx/templates/simple/stats.html
index eecd88903..098a54065 100644
--- a/searx/templates/simple/stats.html
+++ b/searx/templates/simple/stats.html
@@ -1,12 +1,15 @@
{% from 'simple/macros.html' import icon %}
+{% from '__common__/new_issue.html' import new_issue %}
{% extends "simple/base.html" %}
{%- macro th_sort(column_order, column_name) -%}
- {% if column_order==sort_order %}
+ {% if selected_engine_name %}
+ {{ column_name }}
+ {% elif column_order==sort_order %}
{{ column_name }} {{ icon('arrow-dropdown') }}
{% else %}
- {{ column_name }}
+ {{ column_name }}
{% endif %}
{%- endmacro -%}
@@ -15,12 +18,12 @@
searx
-{{ _('Engine stats') }}
+{{ _('Engine stats') }}{% if selected_engine_name %} - {{ selected_engine_name }}{% endif %}
{% if not engine_stats.get('time') %}
{{ _('There is currently no data available. ') }}
{% else %}
-
+
{{ th_sort('name', _("Engine name")) }} |
{{ th_sort('score', _('Scores')) }} |
@@ -30,7 +33,7 @@
{% for engine_stat in engine_stats.get('time', []) %}
- {{ engine_stat.name }} |
+ {{ engine_stat.name }} |
{% if engine_stat.score %}
{{ engine_stat.score|round(1) }}
@@ -90,4 +93,61 @@
|
{% endif %}
+
+ {% if selected_engine_name %}
+ {% for secondary in [False, True] %}
+ {% set ns = namespace(first=true) %}
+ {% for error in engine_reliabilities[selected_engine_name].errors %}
+ {% if secondary == error.secondary %}
+ {% if ns.first %}
+ {% set ns.first = false %}
+ {% if secondary %}{{ _('Warnings') }}{% else %}{{ _('Errors and exceptions') }}{% endif %}
+ {% endif %}
+
+
+
+ {%- if error.exception_classname -%}
+ {{ _('Exception') }} | {{ error.exception_classname }} |
+ {%- elif error.log_message -%}
+ {{ _('Message') }} | {{ error.log_message }} |
+ {%- endif -%}
+ {{ _('Percentage') }} | {{ error.percentage }} |
+
+ {% if error.log_parameters and error.log_parameters != (None, None, None) %}{{ _('Parameter') }} | {{- '' -}}
+
+ {%- for param in error.log_parameters -%}
+ {{ param }}
+ {%- endfor -%}
+ |
+
+ {% endif %}
+ {{ _('Filename') }} | {{ error.filename }}:{{ error.line_no }} |
+ {{ _('Function') }} | {{ error.function }} |
+ {{ _('Code') }} | {{ error.code }} |
+
+
+ {% endif %}
+ {% endfor %}
+ {% endfor %}
+ {% if engine_reliabilities[selected_engine_name].checker %}
+ {{ _('Checker') }}
+
+
+ {{ _('Failed test') }} |
+ {{ _('Comment(s)') }} |
+
+ {% for test_name, results in engine_reliabilities[selected_engine_name].checker.items() %}
+
+ {{ test_name }} |
+
+ {% for r in results %} {{ r }} {% endfor %}
+ |
+
+ {% endfor %}
+
+ {% endif %}
+ {{ new_issue(brand.NEW_ISSUE_URL, selected_engine_name, engine_reliabilities[selected_engine_name]) }}
+ {% endif %}
+
+
{% endblock %}
diff --git a/searx/webapp.py b/searx/webapp.py
index d917c16d4..69ec915a7 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -1073,16 +1073,23 @@ def image_proxy():
@app.route('/stats', methods=['GET'])
def stats():
"""Render engine statistics page."""
+ sort_order = request.args.get('sort', default='name', type=str)
+ selected_engine_name = request.args.get('engine', default=None, type=str)
+
+ filtered_engines = dict(filter(lambda kv: (kv[0], request.preferences.validate_token(kv[1])), engines.items()))
+ if selected_engine_name:
+ if selected_engine_name not in filtered_engines:
+ selected_engine_name = None
+ else:
+ filtered_engines = [selected_engine_name]
+
checker_results = checker_get_result()
checker_results = checker_results['engines'] \
if checker_results['status'] == 'ok' and 'engines' in checker_results else {}
- filtered_engines = dict(filter(lambda kv: (kv[0], request.preferences.validate_token(kv[1])), engines.items()))
engine_stats = get_engines_stats(filtered_engines)
engine_reliabilities = get_reliabilities(filtered_engines, checker_results)
- sort_order = request.args.get('sort', default='name', type=str)
-
SORT_PARAMETERS = {
'name': (False, 'name', ''),
'score': (True, 'score', 0),
@@ -1114,6 +1121,7 @@ def stats():
sort_order=sort_order,
engine_stats=engine_stats,
engine_reliabilities=engine_reliabilities,
+ selected_engine_name=selected_engine_name,
)
|