Skip to content

[Issue] Move catalog search indexer outside stores loop #33984

Closed
@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #33227: Move catalog search indexer outside stores loop


Description (*)

There's a plugin (catalogsearchFulltextProductAssignment / Magento\Elasticsearch\Model\Indexer\Fulltext\Plugin\Category\Product\Action\Rows) in the Magento Elastisearch module that hooks in on the Category Products indexer (Magento\Catalog\Model\Indexer\Category\Product\Action\Rows)

This plugin receives the category id's that are reindexed by the Category Products indexer. This plugin collects the assigned products from these categorie id's per store. And inside this loop it triggers a Catalog Search Fulltext reindex for these product id's.

The problem is that the indexer is executed within the stores loop. But the indexer itself already does a reindex for all stores.

We ran in to this issue with our setup that contains 12 stores. 1 category was passed in to the Category Products indexer. The plugin was executed after fetches all connected products for this category (1000+). These 1000 were reindexed in the 12 stores loop and indexed 12 times in each loop.

Manual testing scenarios (*)

  1. Have a Magento setup with a lot of stores
  2. Have a category with a lot of products
  3. Disable the category, save it, enable the category, save it.
  4. Check how long the indexer Category Products takes

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Metadata

Metadata

Labels

Area: PerformanceComponent: ElasticsearchFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Progress: doneReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions