private function getAttributes($category)
    {
        $collection = $this->attributeCollectionFactory->create(['category' => $category]);
        $collection
            ->setCategory($category)
            ->addIsFilterableFilter()
            ->addStoreLabel($category->getStoreId())
            ->setOrder('position', 'ASC')
            ->setOrder('attribute_id', 'ASC');

        $storeId = $this->getStoreId($category);

        if ($storeId && $category->getId()) {
            // Make a side effect on the context that will be used by the fulltext collection's request builder.
            $this->searchContext->setCurrentCategory($category)
                ->setStoreId($storeId);

            /** @var \Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection $fulltextCollection */
            $fulltextCollection = $this->fulltextCollectionFactory->create();
            $fulltextCollection->setStoreId($storeId)
                ->addFieldToFilter('category_ids', $this->getCategoryFilterParam($category));

            $attributeSetIds = array_keys($fulltextCollection->getFacetedData('attribute_set_id'));
            if (!empty($attributeSetIds)) {
                $collection->setAttributeSetFilter($attributeSetIds);
            }
        }

        return $collection->getItems();
    }
private function getAttributes($category)
    {
        $collection = $this->attributeCollectionFactory->create(['category' => $category]);
        $collection
            ->setCategory($category)
            ->addIsFilterableFilter()
            ->addStoreLabel($category->getStoreId())
            ->setOrder('position', 'ASC')
            ->setOrder('attribute_id', 'ASC');

        $storeId = $this->getStoreId($category);

        if ($storeId && $category->getId()) {
            // Make a side effect on the context that will be used by the fulltext collection's request builder.
            $this->searchContext->setCurrentCategory($category)
                ->setStoreId($storeId);

            /** @var \Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection $fulltextCollection */
            $fulltextCollection = $this->fulltextCollectionFactory->create();
            $fulltextCollection->setStoreId($storeId)
                ->addFieldToFilter('category_ids', $this->getCategoryFilterParam($category));

            $attributeSetIds = array_keys($fulltextCollection->getFacetedData('attribute_set_id'));
            if (!empty($attributeSetIds)) {
                $collection->setAttributeSetFilter($attributeSetIds);
            }
        }

        return $collection->getItems();
    }
private function getAttributes ( $ category ) { $ collection = $ this -> attributeCollectionFactory -> create ( [ 'category' => $ category ] ) ; $ collection -> setCategory ( $ category ) -> addIsFilterableFilter ( ) -> addStoreLabel ( $ category -> getStoreId ( ) ) -> setOrder ( 'position' , 'ASC' ) -> setOrder ( 'attribute_id' , 'ASC' ) ; $ storeId = $ this -> getStoreId ( $ category ) ; if ( $ storeId && $ category -> getId ( ) ) { // Make a side effect on the context that will be used by the fulltext collection's request builder. $ this -> searchContext -> setCurrentCategory ( $ category ) -> setStoreId ( $ storeId ) ; /** @var \Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection $fulltextCollection */ $ fulltextCollection = $ this -> fulltextCollectionFactory -> create ( ) ; $ fulltextCollection -> setStoreId ( $ storeId ) -> addFieldToFilter ( 'category_ids' , $ this -> getCategoryFilterParam ( $ category ) ) ; $ attributeSetIds = array_keys ( $ fulltextCollection -> getFacetedData ( 'attribute_set_id' ) ) ; if ( ! empty ( $ attributeSetIds ) ) { $ collection -> setAttributeSetFilter ( $ attributeSetIds ) ; } } return $ collection -> getItems ( ) ; }
Retrieve attribute collection pre-filtered with only filterable attributes.

@param CategoryInterface $category Category

@return \Magento\Catalog\Api\Data\ProductAttributeInterface[]
Retrieve attribute collection pre - filtered with only filterable attributes .