improved search results infos with count exact match

This commit is contained in:
Bachir Soussi Chiadmi 2021-10-26 21:49:44 +02:00
parent fe8cb11378
commit dc2b536be3
1 changed files with 6 additions and 1 deletions

View File

@ -127,6 +127,9 @@ class Base extends ControllerBase {
$this->results['nids'][] = $result->getField('nid')->getValues()[0]; $this->results['nids'][] = $result->getField('nid')->getValues()[0];
} }
$this->exactematch_count = count($this->results['nids']);
// //
// OR QUERY // OR QUERY
// //
@ -243,7 +246,9 @@ class Base extends ControllerBase {
$resp['term'] = $this->term; $resp['term'] = $this->term;
// $resp['count'] = $this->results->getResultCount(); // $resp['count'] = $this->results->getResultCount();
$resp['count'] = count($this->results['nids']); $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'], "@count" => $resp['count'],
"@keys" => $this->keys "@keys" => $this->keys
)); ));