Skip to content

Commit e9a9659

Browse files
committed
MAGETWO-95294: Mysql search slow on the catalog page
- changes after CR
1 parent 3b9ff5c commit e9a9659

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ public function setOrder($attribute, $dir = Select::SQL_DESC)
266266
*/
267267
public function addCategoryFilter(\Magento\Catalog\Model\Category $category)
268268
{
269+
/** This changes need in BIC reasons for support dynamic improved algorithm for price aggregation process. */
269270
if ($this->isCurrentEngineMysql()) {
270271
parent::addCategoryFilter($category);
271272
} else {
@@ -281,6 +282,7 @@ public function addCategoryFilter(\Magento\Catalog\Model\Category $category)
281282
*/
282283
public function setVisibility($visibility)
283284
{
285+
/** This changes need in BIC reasons for support dynamic improved algorithm for price aggregation process. */
284286
if ($this->isCurrentEngineMysql()) {
285287
parent::setVisibility($visibility);
286288
} else {

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,12 @@ public function getFacetedData($field)
584584
public function addCategoryFilter(\Magento\Catalog\Model\Category $category)
585585
{
586586
$this->addFieldToFilter('category_ids', $category->getId());
587-
$this->_productLimitationPrice();
587+
/** This changes need in BIC reasons for support dynamic improved algorithm for price aggregation process. */
588+
if ($this->isCurrentEngineMysql()) {
589+
parent::addCategoryFilter($category);
590+
} else {
591+
$this->_productLimitationPrice();
592+
}
588593

589594
return $this;
590595
}
@@ -598,6 +603,10 @@ public function addCategoryFilter(\Magento\Catalog\Model\Category $category)
598603
public function setVisibility($visibility)
599604
{
600605
$this->addFieldToFilter('visibility', $visibility);
606+
/** This changes need in BIC reasons for support dynamic improved algorithm for price aggregation process. */
607+
if ($this->isCurrentEngineMysql()) {
608+
parent::setVisibility($visibility);
609+
}
601610

602611
return $this;
603612
}

app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchCriteriaResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function __construct(
6161
string $searchRequestName,
6262
int $currentPage,
6363
int $size,
64-
array $orders
64+
?array $orders
6565
) {
6666
$this->builder = $builder;
6767
$this->collection = $collection;

dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ public function testGetProductCollection()
3838
/** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */
3939
$collection = $this->_model->getProductCollection();
4040
$this->assertInstanceOf(\Magento\Catalog\Model\ResourceModel\Product\Collection::class, $collection);
41-
$ids = $collection->getAllIds();
42-
$this->assertEquals(2, count($ids));
41+
$this->assertEquals(2, $collection->count());
4342
$this->assertSame($collection, $this->_model->getProductCollection());
4443
}
4544

0 commit comments

Comments
 (0)