From dc2b536be37d5c5c3852cc3c77f7663b28368920 Mon Sep 17 00:00:00 2001 From: bach Date: Tue, 26 Oct 2021 21:49:44 +0200 Subject: [PATCH] improved search results infos with count exact match --- web/modules/custom/materio_sapi/src/Controller/Base.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/modules/custom/materio_sapi/src/Controller/Base.php b/web/modules/custom/materio_sapi/src/Controller/Base.php index 541413b..ab8eaf8 100644 --- a/web/modules/custom/materio_sapi/src/Controller/Base.php +++ b/web/modules/custom/materio_sapi/src/Controller/Base.php @@ -127,6 +127,9 @@ class Base extends ControllerBase { $this->results['nids'][] = $result->getField('nid')->getValues()[0]; } + $this->exactematch_count = count($this->results['nids']); + + // // OR QUERY // @@ -243,7 +246,9 @@ class Base extends ControllerBase { $resp['term'] = $this->term; // $resp['count'] = $this->results->getResultCount(); $resp['count'] = count($this->results['nids']); - $resp['infos'] = t('The search found @count result(s) with keywords @keys.', array( + $resp['exactematch_count'] = $this->exactematch_count; + $resp['infos'] = t('The search found @exactmatchcount exact match result(s) for @count total result(s) with keywords @keys', array( + "@exactmatchcount" => $resp['exactematch_count'], "@count" => $resp['count'], "@keys" => $this->keys ));