Browse Source

improved search results infos with count exact match

bach 3 years ago
parent
commit
dc2b536be3
1 changed files with 6 additions and 1 deletions
  1. 6 1
      web/modules/custom/materio_sapi/src/Controller/Base.php

+ 6 - 1
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
       ));