From af942693baf44f04a6c9b8671193241a88c7ee20 Mon Sep 17 00:00:00 2001 From: kouralex <1723419+kouralex@users.noreply.github.com> Date: Tue, 14 Jul 2020 21:47:41 +0300 Subject: [PATCH] fix a bug in working vocabulary search --- controller/WebController.php | 2 +- view/search-result.twig | 2 +- view/vocab-search-listing.twig | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/controller/WebController.php b/controller/WebController.php index ce3078000..946f9619c 100644 --- a/controller/WebController.php +++ b/controller/WebController.php @@ -386,7 +386,7 @@ public function invokeVocabularySearch($request) try { $vocabTypes = $this->model->getTypes($request->getVocabid(), $request->getLang()); } catch (Exception $e) { - header("HTTP/1.0 206 Partial Content"); + header("HTTP/1.0 500 Internal Server Error"); if ($this->model->getConfig()->getLogCaughtExceptions()) { error_log('Caught exception: ' . $e->getMessage()); } diff --git a/view/search-result.twig b/view/search-result.twig index dddfa5b7e..2cf70aceb 100644 --- a/view/search-result.twig +++ b/view/search-result.twig @@ -2,7 +2,7 @@

{% trans %}{{ search_count }} results for '{{ term }}'{% endtrans %}{% if limit_type %}, {% trans "limited to type" %} '{% for type in limit_type %}{{ type }}{% if loop.last == false %}, {% endif %}{% endfor %}'{% endif %}{% if limit_parent %}, {% trans "limited to parent" %} '{{ limit_parent }}'{% endif %}{% if limit_group %}, {% trans "limited to group" %} '{{ limit_group }}'{% endif %}{% if limit_scheme %}, {% trans "limited to scheme" %} '{% for scheme in limit_scheme %}{{ scheme }}{% if loop.last == false %}, {% endif %}{% endfor %}'{% endif %}

{% if limit_type or limit_parent or limit_group or limit_scheme %}{% endif %} {% endif %} -{% if search_results and search_results|length == 0 %}

{% trans 'The search provided no results.' %}

{% endif %} +{% if search_results is defined and search_results|length == 0 %}

{% trans 'The search provided no results.' %}

{% endif %} {% for concept in search_results %} {# loop through the hits #}
{% spaceless %} diff --git a/view/vocab-search-listing.twig b/view/vocab-search-listing.twig index b680566a7..159bd320c 100644 --- a/view/vocab-search-listing.twig +++ b/view/vocab-search-listing.twig @@ -5,13 +5,13 @@ {% block content %}
{% include 'search-result.twig' %} - {% if not search_results and request.vocabid == 'null' and not global_search %} + {% if search_results is not defined and not global_search %}
+ {% if request.vocabid == 'null' %}

{% trans %}Error: Requested vocabulary not found!{% endtrans %}

-
- {% elseif not search_results and request.vocabid and not global_search %} -
+ {% else %}

{% trans %}Error: Search failed for vocabulary!{% endtrans %}

+ {% endif %}
{% endif %}