Skip to content

Commit df9c4ef

Browse files
author
Oleksandr Iegorov
committed
MC-41647: SKU Search very slow on Admin Panel
1 parent aa9485a commit df9c4ef

File tree

1 file changed

+15
-1
lines changed
  • app/code/Magento/CatalogSearch/Model/ResourceModel/Search

1 file changed

+15
-1
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,25 @@ private function prepareIndexEnforcements() : array
211211
$result = [];
212212
foreach (self::INDEX_USAGE_ENFORCEMENTS as $table => $index) {
213213
$table = $this->getTable($table);
214-
$result[$table] = $index;
214+
if ($this->isIndexExists($table, $index)) {
215+
$result[$table] = $index;
216+
}
215217
}
216218
return $result;
217219
}
218220

221+
/**
222+
* Check if index exists in the table
223+
*
224+
* @param string $table
225+
* @param string $index
226+
* @return bool
227+
*/
228+
private function isIndexExists(string $table, string $index) : bool
229+
{
230+
return array_key_exists($index, $this->_conn->getIndexList($table));
231+
}
232+
219233
/**
220234
* Retrieve SQL for search entities
221235
*

0 commit comments

Comments
 (0)