Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit fe79512

Browse files
committed
MAGETWO-57006: [Forwardport] Performance improvement on Catalog Fulltext indexer
1 parent b543f6a commit fe79512

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,16 @@ public function getSearchableProducts(
184184
$lastProductId = 0,
185185
$batch = 100
186186
) {
187-
$products = $this->connection->fetchAll(
188-
$this->getSelectForSearchableProducts($storeId, $staticFields, $productIds, $lastProductId, $batch)->where(
187+
188+
$select = $this->getSelectForSearchableProducts($storeId, $staticFields, $productIds, $lastProductId, $batch);
189+
if ($productIds === null) {
190+
$select->where(
189191
'e.entity_id < ?',
190192
$lastProductId ? $this->antiGapMultiplier * $batch + $lastProductId + 1 : $batch + 1
191-
)
192-
);
193-
if (!$products) {
193+
);
194+
}
195+
$products = $this->connection->fetchAll($select);
196+
if ($productIds === null && !$products) {
194197
// try to search without limit entity_id by batch size for cover case with a big gap between entity ids
195198
$products = $this->connection->fetchAll(
196199
$this->getSelectForSearchableProducts($storeId, $staticFields, $productIds, $lastProductId, $batch)

0 commit comments

Comments
 (0)