Smile\ElasticsuiteCatalog\Model\Product\Indexer\Fulltext\Datasource\CategoryData::addData PHP Method

addData() public method

public addData ( $storeId, array $indexData )
$indexData array
    public function addData($storeId, array $indexData)
    {
        $categoryData = $this->resourceModel->loadCategoryData($storeId, array_keys($indexData));
        foreach ($categoryData as $categoryDataRow) {
            $productId = (int) $categoryDataRow['product_id'];
            unset($categoryDataRow['product_id']);
            $categoryDataRow = array_merge($categoryDataRow, ['category_id' => (int) $categoryDataRow['category_id'], 'is_parent' => (bool) $categoryDataRow['is_parent'], 'name' => (string) $categoryDataRow['name']]);
            if (isset($categoryDataRow['position']) && $categoryDataRow['position'] !== null) {
                $categoryDataRow['position'] = (int) $categoryDataRow['position'];
            }
            $indexData[$productId]['category'][] = array_filter($categoryDataRow);
        }
        return $indexData;
    }