Algolia_Algoliasearch_Model_Indexer_Abstract::reindexSpecificCategories PHP Method

reindexSpecificCategories() public method

This function will update all the requested categories and their child categories in Algolia. You can provide either a single category ID or an array of category IDs. A category ID should be either a string or an integer.
public reindexSpecificCategories ( array | string | integer $updateCategoryIds )
$updateCategoryIds array | string | integer
    public function reindexSpecificCategories($updateCategoryIds)
    {
        $updateCategoryIds = (array) $updateCategoryIds;
        foreach ($updateCategoryIds as $id) {
            /** @var Mage_Catalog_Model_Category $categoryModel */
            $categoryModel = Mage::getModel('catalog/category');
            $categories = $categoryModel->getCategories($id);
            foreach ($categories as $category) {
                $updateCategoryIds[] = $category->getId();
            }
        }
        $this->engine->rebuildCategoryIndex(null, $updateCategoryIds);
    }