Skip to content

Commit 1c8b19a

Browse files
authored
Get isTopSearchResult() from queryCollection
Logic to determine if search term is a 'TopSearchResult' moved to Collection.
1 parent 534ccc2 commit 1c8b19a

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

app/code/Magento/Search/Model/PopularSearchTerms.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,8 @@ public function __construct(
4848
*/
4949
public function isCacheable(string $term, int $storeId)
5050
{
51-
$terms = $this->queryCollection
52-
->setPopularQueryFilter($storeId)
53-
->setPageSize($this->getMaxCountCacheableSearchTerms($storeId))
54-
->load()
55-
->getColumnValues('query_text');
56-
57-
return in_array($term, $terms);
51+
$maxCountCacheableSearchTerms = $this->getMaxCountCacheableSearchTerms($storeId);
52+
return $this->queryCollection->isTopSearchResult($term, $storeId, $maxCountCacheableSearchTerms);
5853
}
5954

6055
/**

0 commit comments

Comments
 (0)