-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Component: Framework/IndexerIssue: Cannot ReproduceCannot reproduce the issue on the latest `2.4-develop` branchCannot reproduce the issue on the latest `2.4-develop` branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release
Description
Preconditions (*)
- Magento CE <= 2.2.6
- Magento Commerce Edition <= 2.2.6
Steps to reproduce (*)
- Run magento indexer:reindex to make all indexes up to date.
- Switch all indexes to the "Update Scheduled" mode.
- Set up Cron.
- Create a simple product (visible at the frontend, qty > 0)
- Create a category.
- Go to the frontend and make sure that the category is empty.
- Open the created category (step 4) and assign the created product to it.
- Save category changes.
- Wait until Cron reindexes category changes or run magento indexer:reindex catalog_category_product.
- Open the category at the frontend.
Expected result (*)
- Category must contain the product.
Actual result (*)
- The category is still empty
The problem
It looks like the category uses the information from the 'catalogsearch_fulltext' index because running magento indexer:reindex catalogsearch_fulltext solves the issue.
The solution
The solution is simple: track changes in the "catalog_category_product" table and update the "catalogsearch_fulltext_cl" changelog table.
This can be done by adding an additional subscriber:
<table name="catalog_category_product" entity_column="product_id" />
to the vendor/magento/module-catalog-search/etc/mview.xml file.
So the updated file should look this way:
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Mview/etc/mview.xsd">
<view id="catalogsearch_fulltext" class="\Magento\CatalogSearch\Model\Indexer\Mview\Action" group="indexer">
<subscriptions>
<table name="catalog_product_entity" entity_column="entity_id" />
<table name="catalog_product_entity_int" entity_column="entity_id" />
<table name="catalog_product_entity_decimal" entity_column="entity_id" />
<table name="catalog_product_entity_text" entity_column="entity_id" />
<table name="catalog_product_entity_varchar" entity_column="entity_id" />
<table name="catalog_product_entity_datetime" entity_column="entity_id" />
<table name="catalog_product_website" entity_column="product_id" />
<table name="cataloginventory_stock_item" entity_column="product_id" />
<table name="catalog_product_bundle_selection" entity_column="parent_product_id" />
<table name="catalog_product_super_link" entity_column="product_id" />
<table name="catalog_product_link" entity_column="product_id" />
<table name="catalog_category_product" entity_column="product_id" />
</subscriptions>
</view>
</config>
Metadata
Metadata
Assignees
Labels
Component: Framework/IndexerIssue: Cannot ReproduceCannot reproduce the issue on the latest `2.4-develop` branchCannot reproduce the issue on the latest `2.4-develop` branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release