Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not indexing In-stock products #3351

Open
adarshkhatri opened this issue Jun 16, 2022 · 3 comments
Open

Not indexing In-stock products #3351

adarshkhatri opened this issue Jun 16, 2022 · 3 comments

Comments

@adarshkhatri
Copy link

MSI plugin class prevents indexing in-stock products in special scenarios. When indexing Magento indexes products in a batch of 500 (default). On each batch, it goes to loop until it finds 0 products. Let's say there are 50,000 SKUs and the system is indexing
when on the 10th batch, it finds 460 products, and the MSI plugin checks if these consist of any out-of-stock products and returns only in-stock arrays. If none is found it then returns an empty array. Now, when Magento receives 0 products it thinks it reached the end of products and then stops indexing after that batch. Meaning there could be more products that are in stock that needs to be indexed.

In Magento this line https://github.com/magento/magento2/blob/28c1f28a2552de69158b40d1eaf84e45430c16f9/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php#L382 it loops through catalog_entity_table in a batch of 500 (default).

When MSI returns 0 products of that batch (

), Magento thinks there are no more products to index and stops indexing rest of the products.

Preconditions (*)

  1. Magento Version: 2.4.3-p1

Steps to reproduce (*)

  1. Have SKUs more than 20,000 or
  2. Configure the indexing batch to less than 100 when having less SKUs https://developer.adobe.com/commerce/php/development/components/indexing/optimization/

Expected result (*)

  1. Should index all in-stock products when Display Out of Stock Products is set to No in config

Actual result (*)

  1. Doesn't index all in-stock products
@m2-assistant
Copy link

m2-assistant bot commented Jun 16, 2022

Hi @adarshkhatri. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.

Add a comment to assign the issue: @magento I am working on this


@sdouma
Copy link

sdouma commented Sep 30, 2022

That's not how it works and if it was don't you think you would see this on a default instance with sample data.

@adarshkhatri
Copy link
Author

adarshkhatri commented Sep 30, 2022

You can try with the default instance, at least for me (I am in the commerce version) it is behaving this way. Regardless, the system should index all the in-stock products, even out of 100,000 products, only 2 items (entity ID 1 and entity ID 100,000 are in stock). Currently, the system only indexes entity ID 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants