I am trying to exclude child products from search. Say I have a bundle product B1 with 'xyz' name and it has a child with name 'abc'. Now searching for 'abc' in frontend also gives the product B1 in search results.

What I need is If I search 'abc' then I should not get product B1 in the search results. I have tried following solutions but they are related to magento 1

CatalogSearch - exclude child product names from fulltext


In magento2.3.2 I did not find Mage_CatalogSearch_Model_Resource_Fulltext::_rebuildStoreIndex function. ofcourse I looked for this inside vendor/magento/module-catalog-search/Model/ResourceModel/Fulltext.php

But I found a similar function that I felt is doing the reindexing part.function is next() It is located in


I tried commenting the following line as suggested in above solutions

// $productChildren = $this->productRelations[$productData['entity_id']];
    // if ($productChildren) {
        // foreach ($productChildren as $productChildId) {
            // if (isset($this->productAttributes[$productChildId])) {
                // $productChildAttr = $this->productAttributes[$productChildId];
                // if (!isset($productChildAttr[$this->status->getId()])
                    // || !in_array($productChildAttr[$this->status->getId()], $this->statusIds)
                // ) {
                    // continue;
                // }

                // $hasChildren = true;
                // $productIndex[$productChildId] = $productChildAttr;
            // }
        // }
    // }

cleaned cache, reindexed, but still getting results based on child products. Any suggestion how I can achieve this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.