{% 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 is defined and search_results|length == 0 %}
{% trans 'The search provided no results.' %}
{% endif %}
+{% if global_search and not search_failed and skipped_vocabs|length > 0 %}
+
+{% for voc in skipped_vocabs %}
+{% set vocTitle = voc.title %}
+
{% trans %}Warning: Skipped searching from '{{vocTitle}}' vocabulary!{% endtrans %}
+{% endfor %}
+
+{% endif %}
+{% if search_results is not null and search_results|length == 0 %}
{% trans 'The search provided no results.' %}
{% endif %}
{% for concept in search_results %} {# loop through the hits #}
H#}YLsg4vNF8cq{zkpWkzAC3KI?eY{SNB<27CNnY)ZKfb^m45NY!I7mz%I2
z?%YJ9Du_c>FdVfe9z@+R8}*@CfLhfnunE3`8o^4`93MiBSS{-QZ|(7`s2(?B0qOb(
z4A=Xgz|LR}B%^v-jB3C#RLi%ZDtryqfCD%lKShmD4~8KHQ!oe@pzdFYdf*ysCF;R%
zVHuvnNS<#-^>lkU2{lB1)PqY=bGR7!2%2(KkE&2Tt+wTJ7)tpP>b@%&hJPYMY#Q})
z%OR-q9#lPT(NRS{c2q$Ms+@+paH4ez>IOgFgeBH8)LZa0HpiDy4c?Br{~+=rnPaGq
z{fL^ne^J+kB{Ke+!_K@58oKVNRh@t}I1)oJwzoUi9g%fo;!sm@7wSRNaVpNjfp`)%
z0*#a02S%V?@AjyM3`Aznj80bct1f{5Yz@wbl)&hHOK9
zaQ34b@-_0$T<1sk`TDveHWW2te$*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FZ9!W9_?`ky>Zp&A$f44Y!*Iq3C^(IKwJ>u@*P!GEI-
zZ@|LJ^!@KZ!3w*e5556M;7D|2Uc|n*2VEQgK`Xd`KCn66*LLWGyW^uc7_IjZ+Ogy4
z$ecz;>O2v
z|DL$NAHD8#5%YU
z9l5ROVy?y`c(9D|&!X^bm*m2A$n=Lz=u{j*A9M=G;iuRe2X#$GU@kUfe=+(#uSFZO
z3z?m86#ej=i^p@i@kX)V3hUu5-57s|Xm~s^9-Z@rXwTQ76>mo?`cpjqG1~Ai(Vm@0
z-}7*F(y$`5=k3v}Xd22RdbcM;rQCih>WS(>I%22MMR*Yztk9x7>FGe^QDFqy(0SAyw~$T5wQy;>oQbWE=7LW(Yt;Fpx`60Q*9k!KZ8foSZ
z+b%M~`5!`lMkbRCvX0zEeoPvWDWsgNCX>i*79jcSgy-&4D0O-V(g{{s!)pF#it
diff --git a/view/scripts.twig b/view/scripts.twig
index 1a980a287..0f62b0efe 100644
--- a/view/scripts.twig
+++ b/view/scripts.twig
@@ -2,6 +2,8 @@
var noResultsTranslation = "{% trans %}No results{% endtrans %}";
var loading_text = "{% trans %}Loading more items{% endtrans %}";
+var loading_failed_text = "{% trans %}Error: Loading more items failed!{% endtrans %}";
+var loading_retry_text = "{% trans %}Retry{% endtrans %}";
var jstree_loading = "{% trans %}Loading{% endtrans %} ...";
var results_disp = "{% trans %}All %d results displayed{% endtrans %}";
var all_vocabs = "{% trans %}from all{% endtrans %}";
From 189fe980b63d5e4f22645aad00aefe94cfd65fb5 Mon Sep 17 00:00:00 2001
From: Osma Suominen
Date: Thu, 9 Sep 2021 12:50:08 +0300
Subject: [PATCH 6/9] Avoid using return value from method that doesn't return
anything (bug found by sonarqube)
---
controller/WebController.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/controller/WebController.php b/controller/WebController.php
index 8a7b07861..ed0ea6f22 100644
--- a/controller/WebController.php
+++ b/controller/WebController.php
@@ -337,7 +337,8 @@ public function invokeGlobalSearch($request)
error_log('Caught exception: ' . $e->getMessage());
}
header("HTTP/1.0 400 Bad Request");
- return $this->invokeGenericErrorPage($request, $e->getMessage());
+ $this->invokeGenericErrorPage($request, $e->getMessage());
+ return;
}
}
}
From 14eac78e82cb3434df8d911d52386c28df26e597 Mon Sep 17 00:00:00 2001
From: Osma Suominen
Date: Thu, 9 Sep 2021 12:52:27 +0300
Subject: [PATCH 7/9] use empty() instead of sizeof(xxx) == 0 which is clearer
(bug found by sonarqube)
---
controller/WebController.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/controller/WebController.php b/controller/WebController.php
index ed0ea6f22..d3725a086 100644
--- a/controller/WebController.php
+++ b/controller/WebController.php
@@ -348,7 +348,7 @@ public function invokeGlobalSearch($request)
if (sizeOf($vocabObjects) != 1) {
// global search, either from all (sizeOf($vocabObjects) == 0) or from selected ones
- if (sizeOf($vocabObjects) == 0) {
+ if (empty($vocabObjects)) {
$vocabObjects = $this->model->getVocabularies();
}
$defaultEndpoint = $this->model->getConfig()->getDefaultEndpoint();
From c7771867e050ce7b4ef3d125b84f3e068702a574 Mon Sep 17 00:00:00 2001
From: Osma Suominen
Date: Thu, 9 Sep 2021 15:28:51 +0300
Subject: [PATCH 8/9] Adjust for change to ValueError
---
model/Model.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/model/Model.php b/model/Model.php
index a4ed6b323..5cc570140 100644
--- a/model/Model.php
+++ b/model/Model.php
@@ -245,7 +245,7 @@ public function searchConcepts($params)
try {
$hitvoc = $this->getVocabularyByGraph($hit['graph']);
$hit['vocab'] = $hitvoc->getId();
- } catch (Exception $e) {
+ } catch (ValueError $e) {
trigger_error($e->getMessage(), E_USER_WARNING);
$hitvoc = null;
$hit['vocab'] = "???";
@@ -255,7 +255,7 @@ public function searchConcepts($params)
$hit['voc'] = $hitvoc;
- if (!$hitvoc->containsURI($hit['uri'])) {
+ if ($hitvoc === null || !$hitvoc->containsURI($hit['uri'])) {
// if uri is a external vocab uri that is included in the current vocab
$realvoc = $this->guessVocabularyFromURI($hit['uri'], $voc !== null ? $voc->getId() : null);
if ($realvoc !== $hitvoc) {
From ee5e40f4b72b6d0d59f3ad145cddd12b5b256e8d Mon Sep 17 00:00:00 2001
From: Osma Suominen
Date: Thu, 9 Sep 2021 16:03:57 +0300
Subject: [PATCH 9/9] Remove warning message about skipped vocabs (too
obtrusive and the user can't do anything about it)
---
controller/WebController.php | 16 ----------------
view/search-result.twig | 8 --------
2 files changed, 24 deletions(-)
diff --git a/controller/WebController.php b/controller/WebController.php
index d3725a086..f2034280d 100644
--- a/controller/WebController.php
+++ b/controller/WebController.php
@@ -344,21 +344,6 @@ public function invokeGlobalSearch($request)
}
$parameters->setVocabularies($vocabObjects);
- $nondefaultEndpointVocs = array();
-
- if (sizeOf($vocabObjects) != 1) {
- // global search, either from all (sizeOf($vocabObjects) == 0) or from selected ones
- if (empty($vocabObjects)) {
- $vocabObjects = $this->model->getVocabularies();
- }
- $defaultEndpoint = $this->model->getConfig()->getDefaultEndpoint();
- foreach($vocabObjects as $voc) {
- if ($voc->getEndpoint() !== $defaultEndpoint) {
- $nondefaultEndpointVocs[] = $voc;
- }
- }
- }
-
$counts = null;
$searchResults = null;
$errored = false;
@@ -386,7 +371,6 @@ public function invokeGlobalSearch($request)
'rest' => $parameters->getOffset()>0,
'global_search' => true,
'search_failed' => $errored,
- 'skipped_vocabs' => $nondefaultEndpointVocs,
'term' => $request->getQueryParamRaw('q'),
'lang_list' => $langList,
'vocabs' => str_replace(' ', '+', $vocabs),
diff --git a/view/search-result.twig b/view/search-result.twig
index a2530d9c1..4e1d521b5 100644
--- a/view/search-result.twig
+++ b/view/search-result.twig
@@ -2,14 +2,6 @@
{% 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 global_search and not search_failed and skipped_vocabs|length > 0 %}
-
-{% for voc in skipped_vocabs %}
-{% set vocTitle = voc.title %}
-
{% trans %}Warning: Skipped searching from '{{vocTitle}}' vocabulary!{% endtrans %}
-{% endfor %}
-
-{% endif %}
{% if search_results is not null and search_results|length == 0 %}
{% trans 'The search provided no results.' %}
{% endif %}
{% for concept in search_results %} {# loop through the hits #}