public function getSearchQueriesByChildren(CategoryInterface $rootCategory)
    {
        $queries     = [];
        $childrenIds = $rootCategory->getResource()->getChildren($rootCategory, false);

        if (!empty($childrenIds)) {
            $storeId            = $this->getStoreId();
            $categoryCollection = $this->categoryCollectionFactory->create()->setStoreId($storeId);

            $categoryCollection
                ->setStoreId($this->getStoreId())
                ->addIsActiveFilter()
                ->addIdFilter($childrenIds)
                ->addAttributeToSelect(['virtual_category_root', 'is_virtual_category', 'virtual_rule']);

            foreach ($categoryCollection as $category) {
                $childQuery = $this->getCategorySearchQuery($category);
                if ($childQuery !== null) {
                    $queries[$category->getId()] = $childQuery;
                }
            }
        }

        return $queries;
    }
public function getSearchQueriesByChildren(CategoryInterface $rootCategory)
    {
        $queries     = [];
        $childrenIds = $rootCategory->getResource()->getChildren($rootCategory, false);

        if (!empty($childrenIds)) {
            $storeId            = $this->getStoreId();
            $categoryCollection = $this->categoryCollectionFactory->create()->setStoreId($storeId);

            $categoryCollection
                ->setStoreId($this->getStoreId())
                ->addIsActiveFilter()
                ->addIdFilter($childrenIds)
                ->addAttributeToSelect(['virtual_category_root', 'is_virtual_category', 'virtual_rule']);

            foreach ($categoryCollection as $category) {
                $childQuery = $this->getCategorySearchQuery($category);
                if ($childQuery !== null) {
                    $queries[$category->getId()] = $childQuery;
                }
            }
        }

        return $queries;
    }
public function getSearchQueriesByChildren ( CategoryInterface $ rootCategory ) { $ queries = [ ] ; $ childrenIds = $ rootCategory -> getResource ( ) -> getChildren ( $ rootCategory , false ) ; if ( ! empty ( $ childrenIds ) ) { $ storeId = $ this -> getStoreId ( ) ; $ categoryCollection = $ this -> categoryCollectionFactory -> create ( ) -> setStoreId ( $ storeId ) ; $ categoryCollection -> setStoreId ( $ this -> getStoreId ( ) ) -> addIsActiveFilter ( ) -> addIdFilter ( $ childrenIds ) -> addAttributeToSelect ( [ 'virtual_category_root' , 'is_virtual_category' , 'virtual_rule' ] ) ; foreach ( $ categoryCollection as $ category ) { $ childQuery = $ this -> getCategorySearchQuery ( $ category ) ; if ( $ childQuery !== null ) { $ queries [ $ category -> getId ( ) ] = $ childQuery ; } } } return $ queries ; }
Retrieve search queries of children categories.

@param \Magento\Catalog\Api\Data\CategoryInterface $rootCategory Root category.

@return \Smile\ElasticsuiteCore\Search\Request\QueryInterface[]
Retrieve search queries of children categories .