Skip to content

Commit 4b705fc

Browse files
author
Oleksandr Iegorov
committed
MC-41647: SKU Search very slow on Admin Panel
1 parent 6fa4c4d commit 4b705fc

File tree

1 file changed

+3
-2
lines changed
  • app/code/Magento/CatalogSearch/Model/ResourceModel/Search

1 file changed

+3
-2
lines changed

app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,16 +276,17 @@ protected function _getSearchEntityIdsSql($query, $searchOnlyInCurrentStore = tr
276276
\Zend_Db::INT_TYPE
277277
);
278278
$condition2 = '`t1`.`store_id` = 0';
279+
$quotedField = $this->_conn->quoteIdentifier($ifValueId);
279280
$condition3 = $this->_conn->quoteInto(
280-
'IFNULL(`t2`.`value`, `t1`.`value`) LIKE ?',
281+
$quotedField . ' LIKE ?',
281282
$this->_resourceHelper->addLikeEscape($this->_searchQuery, $likeOptions)
282283
);
283284

284285
//force index statement not implemented in framework
285286
// phpcs:ignore Magento2.SQL.RawQuery
286287
$select = sprintf(
287288
'SELECT `t1`.`%s` FROM `%s` AS `t1` FORCE INDEX(%s) LEFT JOIN `%s` AS `t2`
288-
ON %s WHERE %s AND %s AND %s',
289+
ON %s WHERE %s AND %s AND (%s)',
289290
$linkField,
290291
$table,
291292
$preparedIndexEnforcements[$table],

0 commit comments

Comments
 (0)