Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Indexer\Fulltext\Action\Full::getRelationsByChild PHP Method

getRelationsByChild() public method

Retrieve products relations by childrens
public getRelationsByChild ( array $childrenIds ) : array
$childrenIds array The product ids being reindexed
return array
    public function getRelationsByChild($childrenIds)
    {
        $select = $this->getConnection()->select()->from($this->resource->getTableName('catalog_product_relation'), 'parent_id')->where('child_id IN(?)', $childrenIds);
        return $this->getConnection()->fetchCol($select);
    }

Usage Example

 /**
  * Process full-text reindex for product ids
  *
  * @param mixed $ids The product ids to reindex
  */
 protected function processFullTextIndex($ids)
 {
     $fullTextIndexer = $this->indexerRegistry->get(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID);
     if (!is_array($ids)) {
         $ids = [$ids];
     }
     $parentIds = $this->fullIndexer->getRelationsByChild($ids);
     $processIds = $parentIds ? array_merge($parentIds, $ids) : $ids;
     if (!$fullTextIndexer->isScheduled()) {
         if (!empty($processIds)) {
             $fullTextIndexer->reindexList($processIds);
         }
     }
 }