Reopening this discussion, as none of the found solutions worked.
I have about 60 categories and subcategories, going down 4 levels deep. Number of products is irrelevant, this bug reproduces with 10 products, as well as with 4000.
What I've tried
- Setting the Root Category to not-anchored, and then to anchored back again
- Just having one root category
- Setting all categories to
is_anchor=false
, then back tois_anchor=true
in a bulk fashion straight in the database (UPDATE catalog_category_entity_int set value = 1 where attribute_id = 54;
) - Flushing caches and reindexing in the meantime
- Commenting out the exception, but then the search simply does not work (returns a bunch of non-related products)
Versions
- Magento 2.3.5-p1
- Theme "Infortis Ultimo Modif"
- PHP 7.3.24
- No ElasticSearch
References
- Magento 2 - Filter through non anchor categories throws “The bucket doesn't exist.” exception
- Bucket does not exist in Magento 2 error
- Exception when filtering by category in Layered Navigation (Bucket does not exist
- when i click on category filter on Category List page Category filter getting error “Bucket does not exist”
- How to Set Anchor to YES in all Categories in Magento 2
Stacktrace
Exception #0 (Magento\Framework\Exception\StateException): The bucket doesn't exist.
<pre>#1 Manadev\ProductCollection\Resources\Collections\FullTextProductCollection->getFacetedData('category') called at [generated/code/Manadev/ProductCollection/Resources/Collections/FullTextProductCollection/Interceptor.php:63]
#2 Manadev\ProductCollection\Resources\Collections\FullTextProductCollection\Interceptor->getFacetedData('category') called at [vendor/magento/module-catalog-search/Model/Layer/Filter/Category.php:113]
#3 Magento\CatalogSearch\Model\Layer\Filter\Category->_getItemsData() called at [vendor/magento/module-catalog/Model/Layer/Filter/AbstractFilter.php:202]
#4 Magento\Catalog\Model\Layer\Filter\AbstractFilter->_initItems() called at [vendor/magento/module-catalog/Model/Layer/Filter/AbstractFilter.php:159]
#5 Magento\Catalog\Model\Layer\Filter\AbstractFilter->getItems() called at [vendor/magento/module-catalog/Model/Layer/Filter/AbstractFilter.php:148]
#6 Magento\Catalog\Model\Layer\Filter\AbstractFilter->getItemsCount() called at [vendor/magento/module-catalog/Model/Layer/Category/AvailabilityFlag.php:33]
#7 Magento\Catalog\Model\Layer\Category\AvailabilityFlag->canShowOptions(array(&Magento\CatalogSearch\Model\Layer\Filter\Category#00000000261d0415000000006d43a070#, &Magento\CatalogSearch\Model\Layer\Filter\Attribute#00000000261d041d000000006d43a070#, &Magento\CatalogSearch\Model\Layer\Filter\Attribute#00000000261d0419000000006d43a070#, &Magento\CatalogSearch\Model\Layer\Filter\Attribute#00000000261d041a000000006d43a070#, &Magento\CatalogSearch\Model\Layer\Filter\Attribute#00000000261d0466000000006d43a070#, &Magento\CatalogSearch\Model\Layer\Filter\Attribute#00000000261d0410000000006d43a070#, &Magento\CatalogSearch\Model\Layer\Filter\Attribute#00000000261d0413000000006d43a070#)) called at [vendor/magento/module-catalog/Model/Layer/Category/AvailabilityFlag.php:23]
#8 Magento\Catalog\Model\Layer\Category\AvailabilityFlag->isEnabled(&Magento\Catalog\Model\Layer\Search#00000000261d0597000000006d43a070#, array(&Magento\CatalogSearch\Model\Layer\Filter\Category#00000000261d0415000000006d43a070#, &Magento\CatalogSearch\Model\Layer\Filter\Attribute#00000000261d041d000000006d43a070#, &Magento\CatalogSearch\Model\Layer\Filter\Attribute#00000000261d0419000000006d43a070#, &Magento\CatalogSearch\Model\Layer\Filter\Attribute#00000000261d041a000000006d43a070#, &Magento\CatalogSearch\Model\Layer\Filter\Attribute#00000000261d0466000000006d43a070#, &Magento\CatalogSearch\Model\Layer\Filter\Attribute#00000000261d0410000000006d43a070#, &Magento\CatalogSearch\Model\Layer\Filter\Attribute#00000000261d0413000000006d43a070#)) called at [vendor/magento/module-layered-navigation/Block/Navigation.php:126]
#9 Magento\LayeredNavigation\Block\Navigation->canShowBlock() called at [app/design/frontend/Infortis/base/Magento_LayeredNavigation/templates/layer/view.phtml:18]