8

I am running Magento 2.1.5 and facing a really strange issue. I have over 6,500 products uploaded to the store but some items are not showing up after performing a complete reindex. Of course, some items are out of stock but many of the products that are not showing up in their respective categories are the similar as others that are showing up just fine. These products are simple (not configurable) and belong to do the same attribute group.

Upon searching for the items in search the missing products show up. Upon saving the item the item appears again only to go missing again upon reindex.

After performing reindex one by one, I noticed the issue is affecting the following tables:

catalog_category_product
catalog_product_category

I even went ahead and added a row which made the product appear again on the front-end but after reindexing the row was deleted.

Does anyone have any clue as to what this issue could be? It's very, very strange but I'm hoping there is a simple solution.

Update 02/27/2017: I am still not able figure out a solution for this bug. If any Magento Expert can gain some insight into this and fix it he or she will be rewarded.

4
  • As an update to this issue I want to add the following: For a product that was not showing I manually removed the sub-category that it was associated it and only added it to the parent category. When I performed the above action and then did a full reindex the product did not disappear. I will repeat this over many products to see if this is providing any insight as to where exactly the issue is occurring - hopefully someone can find the bug.
    – SJain
    Commented Feb 22, 2017 at 2:36
  • Were you able to find a solution? We are experiencing the same issue on versions 2.1.4, 2.1.5 and 2.1.6. Several categories are in upper level and lower level (subcategories) at the same time and all categories are set to Anchor to enable filtering. All products are enabled, visibility is set to "Catalog, Search" and all are in stock but most of them disappear after reindexing these indexes; catalog_category_product and catalog_product_category. We are thinking this might be a bug within Magento indexer related to product present both in the same and lower level categories.
    – ElGatito
    Commented May 2, 2017 at 15:30
  • Got the same problem here. Every time I only use catalog_product_category reindex after product data update import product disappears on fronend. After full reindex it's visible again. This is happening on Magento 2.1.7
    – Marceli Po
    Commented Jan 9, 2018 at 13:07
  • im getting the same error and im on magento 2.2.4 and I tried whatever maximum I could do but couldn't resolve the issue. Pls guide - how to solve this problem. More than 350 products are there and after reindex nothing is shown in the frontend, Is there any way we can fix it directly on the database with some SQL. I tried already the suggestion given above but it didnt work may because I couldn't make the changes at right place because the folder structure given above doesnt match with Magento 2.2.4. Pls suggest a solution if possible
    – Ans
    Commented Aug 15, 2018 at 15:03

4 Answers 4

1

Seem that we need to increase the memory limit when running re-index a large of number database:

1) Reset db: open your PHP Admin or Mysql GUI tool

update indexer_state set status = 'invalid' where status != 'valid';

2) Re-index again:

php -dmemory_limit=2048M bin/magento indexer:reindex
6
  • Dear Khoa TruongDinh,
    – SJain
    Commented Feb 22, 2017 at 14:18
  • @SJain did you try my answer above? Commented Feb 22, 2017 at 14:19
  • Dear Khoa TruongDinh, Thank you for your reply. I performed the requested tasks but they had no affect. Upon the SQL query, zero rows were affected and the re-index command performed successfully but it did not change. I am going to attempt this again after updating the missing products so they appear and then try this. If they disappear again then we will know the problem lies somewhere else.
    – SJain
    Commented Feb 22, 2017 at 14:32
  • Ok, the issue still persists. After updating the products so they appear on the store I performed your commands and they have again "disappeared".
    – SJain
    Commented Feb 22, 2017 at 14:35
  • Yes, I replied above. Please let me know your thoughts regarding this.
    – SJain
    Commented Feb 23, 2017 at 14:05
1

I have had the same issue, as an answer I am posting a link with a solution that worked for me. Besides, I cannot comment yet.

Reindexing Magento 2 causes products to be missing on the frontend (not the backend) (Solved) - Magento Stackexchange

1

you can run the following;

php bin/magento indexer:reset
php bin/magento indexer:reindex
php bin/magento cache:flush

Which should revive any missing categories.

1

I'm using Magento2.1.4 and have same issue but solved on github.

STEP 1: Create a new module or use an existing custom module
STEP 2: Create a new Class that extends the Full Action (see below)
STEP 3: Edit the di.xml in the etc directory to include a preference node (see below)
STEP 4: Clear Cache and Reindex

FILE: {company}{module}\Model\Indexer\Product\Category\Action\Full.php

namespace {company}\{module}\Model\Indexer\Product\Category\Action;

class Full extends \Magento\Catalog\Model\Indexer\Category\Product\Action\Full
{
    protected function isRangingNeeded(){
        return false;
    }
}

FILE: {company}{module}\etc\di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference 
            for="Magento\Catalog\Model\Indexer\Category\Product\Action\Full" 
            type="{company}\{module}\Model\Indexer\Product\Category\Action\Full" />
</config>

Hope this helps.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.