elasticsuite
elasticsuite copied to clipboard
Create a category product block with virutal category rule
Preconditions
Magento Version : Magento CE: 2.4.2
ElasticSuite Version : 2.10.11
Environment : Both? :)
Problem:
- in
cms_index_index.xmlI have a piece of code like this:
<block class="Magento\Catalog\Block\Product\ListProduct" name="category.products.list" as="product_list" template="Magento_Catalog::product/list.phtml">
<action method="setData">
<argument name="key" xsi:type="string">category_id</argument>
<argument name="value" xsi:type="string">89</argument>
</action>
<block class="Magento\Framework\View\Element\RendererList" name="category.product.type.details.renderers" as="details.renderers">
<block class="Magento\Framework\View\Element\Template" name="category.product.type.details.renderers.default" as="default"/>
</block>
<block class="Magento\Catalog\Block\Product\ProductList\Toolbar" name="product_list_toolbar" template="Magento_Catalog::product/list/toolbar.phtml">
<block class="Magento\Theme\Block\Html\Pager" name="product_list_toolbar_pager"/>
</block>
<action method="setToolbarBlockName">
<argument name="name" xsi:type="string">product_list_toolbar</argument>
</action>
</block>
- This works perfectly for non virtual product categories (add products the traditional magento way)
- But when I make a rule for virtual products like this:

- All products in the root category are loaded
Expected result
- When I make a product list block I expect that the category and the rules for the products in the category are correctly set
Actual result
- When xdebugging this problem, the rule for a virutal category is not set.
- This means that all products in the shop are loaded
- As you can see in the image above, the rule is working in the backend
Maybe i'm missing something here? To add a block in this block like above? Or is this a small bug?
Well I did not ever know it was possible to pass category_id to a ProductList block through xml like that.
Still learning after so many years playing with Magento :)
Most probably, you are the first to face this case.
How is the category loaded in such context ?
Especially, do you go through this : https://github.com/Smile-SA/elasticsuite/blob/2.10.x/src/module-elasticsuite-virtual-category/Model/Category/Attribute/VirtualRule/ReadHandler.php#L59
The readhandler is responsible of loading the rule associated to the category.
I understand that setting the category_id should make you go into this : https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Catalog/Block/Product/ListProduct.php#L471
What do you have as a result in term of Elasticsearch query ?
Ha nice, always good to be the first one :D
In this file: https://github.com/Smile-SA/elasticsuite/blob/2.10.x/src/module-elasticsuite-virtual-category/Model/Category/Attribute/VirtualRule/ReadHandler.php#L59
On a normal category page $attributeData is filled with the ruled like this:

On the homepage, where the block is loaded, this is null:

Do you have a suggestion how I can c/p the query in elastic for you?
When I go in to this file: https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Catalog/Block/Product/ListProduct.php#L471 then the category_id is always set correctly. Also when you go into this function: https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Catalog/Block/Product/ListProduct.php#L483 and click a few futher down the line.
If you need more information, please do ask, happy to provide this :)
Hello @WouterSteen,
You can enable logging ES queries in:
Stores -> Configuration -> Elasticsuite -> Base settings -> Elasticsearch Client -> Enable Debug Mode
and the queries will be logged into the system.log
And you should see a record smth like that:
[2022-09-21 10:28:05] report.INFO: curl -XPOST 'http://localhost/magento2_default_catalog_product/_search?pretty=true' -d '{"size":20,"sort":[{"category.position":{"order":"asc","missing":"_last","unmapped_type":"keyword","nested":{"path":"category","filter":{"terms":{"category.category_id":["45"],"boost":1}}},"mode":"min"}},{"_score":{"order":"desc"}},{"entity_id":{"order":"desc","missing":"_first","unmapped_type":"keyword"}}],"from":0,"query":{"constant_score":{"filter":{"bool":{"must":[{"term":{"stock.is_in_stock":{"value":true,"boost":1}}},{"terms":{"visibility":[2,4],"boost":1}},{"bool":{"must_not":[{"nested":{"path":"category","score_mode":"none","query":{"bool":{"must":[{"term":{"category.category_id":{"value":45,"boost":1}}},{"term":{"category.is_blacklisted":{"value":true,"boost":1}}}],"must_not":[],"should":[],"boost":1}},"boost":1}}],"boost":1}},{"bool":{"must":[{"nested":{"path":"category","score_mode":"none","query":{"bool":{"must":[{"bool":{"must_not":[{"term":{"category.is_virtual":{"value":true,"boost":1}}}],"boost":1}},{"terms":{"category.category_id":["45"],"boost":1}}],"must_not":[],"should":[],"boost":1}},"boost":1}}],"must_not":[],"should":[],"boost":1}}],"must_not":[],"should":[],"boost":1}},"boost":1}},"aggregations":{"attribute_set_id":{"terms":{"field":"attribute_set_id","size":100000,"order":{"_count":"desc"}}},"indexed_attributes":{"terms":{"field":"indexed_attributes","size":100000,"order":{"_count":"desc"}}},"price.price":{"nested":{"path":"price"},"aggregations":{"price.price":{"filter":{"terms":{"price.customer_group_id":[0],"boost":1}},"aggregations":{"price.price":{"histogram":{"field":"price.price","interval":1,"min_doc_count":1}}}}}},"option_text_color":{"terms":{"field":"option_text_color.untouched","size":10,"order":{"_count":"desc"}}},"option_text_activity":{"terms":{"field":"option_text_activity.untouched","size":10,"order":{"_count":"desc"}}},"option_text_material":{"terms":{"field":"option_text_material.untouched","size":10,"order":{"_count":"desc"}}}},"track_total_hits":true}' [] []
BR, Vadym
Homepage:
[2022-09-22 09:22:17] .INFO: Request Success: {"method":"HEAD","uri":"http://elasticsearch7/magento2_default_catalog_product","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.002317} []
[2022-09-22 09:22:17] .INFO: curl -XHEAD 'http://elasticsearch7/magento2_default_catalog_product?pretty=true' [] []
[2022-09-22 09:22:17] .INFO: Request Success: {"method":"HEAD","uri":"http://elasticsearch7/magento2_voetbalzonenl_catalog_product","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.001034} []
[2022-09-22 09:22:17] .INFO: curl -XHEAD 'http://elasticsearch7/magento2_voetbalzonenl_catalog_product?pretty=true' [] []
[2022-09-22 09:22:17] .INFO: Request Success: {"method":"GET","uri":"http://elasticsearch7/","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.000609} []
[2022-09-22 09:22:17] .INFO: curl -XGET 'http://elasticsearch7/?pretty=true' [] []
[2022-09-22 09:22:17] .INFO: Request Success: {"method":"GET","uri":"http://elasticsearch7/","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.000383} []
[2022-09-22 09:22:17] .INFO: curl -XGET 'http://elasticsearch7/?pretty=true' [] []
[2022-09-22 09:22:17] .INFO: Request Success: {"method":"POST","uri":"http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.001608} []
[2022-09-22 09:22:17] .INFO: curl -XPOST 'http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search?pretty=true' -d '{"size":0,"query":{"constant_score":{"filter":{"bool":{"must":[{"terms":{"visibility":[2,4],"boost":1}},{"bool":{"must_not":[{"nested":{"path":"category","score_mode":"none","query":{"bool":{"must":[{"term":{"category.category_id":{"value":89,"boost":1}}},{"term":{"category.is_blacklisted":{"value":true,"boost":1}}}],"must_not":[],"should":[],"boost":1}},"boost":1}}],"boost":1}},{"terms":{"visibility":[2,4],"boost":1}}],"must_not":[],"should":[],"boost":1}},"boost":1}},"aggregations":{"attribute_set_id":{"terms":{"field":"attribute_set_id","size":100000,"order":{"_count":"desc"}}},"indexed_attributes":{"terms":{"field":"indexed_attributes","size":100000,"order":{"_count":"desc"}}}},"track_total_hits":true}' [] []
[2022-09-22 09:22:17] .INFO: Request Success: {"method":"POST","uri":"http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.001902} []
[2022-09-22 09:22:17] .INFO: curl -XPOST 'http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search?pretty=true' -d '{"size":0,"query":{"constant_score":{"filter":{"bool":{"must":[{"terms":{"visibility":[2,4],"boost":1}},{"bool":{"must_not":[{"nested":{"path":"category","score_mode":"none","query":{"bool":{"must":[{"term":{"category.category_id":{"value":89,"boost":1}}},{"term":{"category.is_blacklisted":{"value":true,"boost":1}}}],"must_not":[],"should":[],"boost":1}},"boost":1}}],"boost":1}},{"terms":{"visibility":[2,4],"boost":1}}],"must_not":[],"should":[],"boost":1}},"boost":1}},"aggregations":{"attribute_set_id":{"terms":{"field":"attribute_set_id","size":100000,"order":{"_count":"desc"}}},"indexed_attributes":{"terms":{"field":"indexed_attributes","size":100000,"order":{"_count":"desc"}}},"price.price":{"nested":{"path":"price"},"aggregations":{"price.price":{"filter":{"terms":{"price.customer_group_id":[0],"boost":1}},"aggregations":{"price.price":{"histogram":{"field":"price.price","interval":1,"min_doc_count":1}}}}}},"option_text_sport_type":{"terms":{"field":"option_text_sport_type.untouched","size":10,"order":{"_count":"desc"}}},"option_text_club":{"terms":{"field":"option_text_club.untouched","size":10,"order":{"_count":"desc"}}},"option_text_club_country":{"terms":{"field":"option_text_club_country.untouched","size":10,"order":{"_count":"desc"}}},"option_text_league":{"terms":{"field":"option_text_league.untouched","size":10,"order":{"_count":"desc"}}}},"track_total_hits":true}' [] []
[2022-09-22 09:22:17] .INFO: Request Success: {"method":"POST","uri":"http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.001887} []
[2022-09-22 09:22:17] .INFO: curl -XPOST 'http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search?pretty=true' -d '{"size":0,"query":{"constant_score":{"filter":{"bool":{"must":[{"terms":{"visibility":[2,4],"boost":1}},{"bool":{"must_not":[{"nested":{"path":"category","score_mode":"none","query":{"bool":{"must":[{"term":{"category.category_id":{"value":89,"boost":1}}},{"term":{"category.is_blacklisted":{"value":true,"boost":1}}}],"must_not":[],"should":[],"boost":1}},"boost":1}}],"boost":1}},{"terms":{"visibility":[2,4],"boost":1}}],"must_not":[],"should":[],"boost":1}},"boost":1}},"aggregations":{"attribute_set_id":{"terms":{"field":"attribute_set_id","size":100000,"order":{"_count":"desc"}}},"indexed_attributes":{"terms":{"field":"indexed_attributes","size":100000,"order":{"_count":"desc"}}}},"track_total_hits":true}' [] []
[2022-09-22 09:22:17] .INFO: Request Success: {"method":"POST","uri":"http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.045634} []
[2022-09-22 09:22:18] .INFO: curl -XPOST 'http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search?pretty=true' -d '{"size":10000,"sort":[{"ticket_valid_from":{"order":"asc","missing":"_last","unmapped_type":"keyword"}},{"_score":{"order":"desc"}},{"entity_id":{"order":"desc","missing":"_first","unmapped_type":"keyword"}}],"from":0,"query":{"constant_score":{"filter":{"bool":{"must":[{"terms":{"visibility":[2,4],"boost":1}},{"bool":{"must_not":[{"nested":{"path":"category","score_mode":"none","query":{"bool":{"must":[{"term":{"category.category_id":{"value":89,"boost":1}}},{"term":{"category.is_blacklisted":{"value":true,"boost":1}}}],"must_not":[],"should":[],"boost":1}},"boost":1}}],"boost":1}},{"terms":{"visibility":[2,4],"boost":1}}],"must_not":[],"should":[],"boost":1}},"boost":1}},"aggregations":{"attribute_set_id":{"terms":{"field":"attribute_set_id","size":100000,"order":{"_count":"desc"}}},"indexed_attributes":{"terms":{"field":"indexed_attributes","size":100000,"order":{"_count":"desc"}}},"price.price":{"nested":{"path":"price"},"aggregations":{"price.price":{"filter":{"terms":{"price.customer_group_id":[0],"boost":1}},"aggregations":{"price.price":{"histogram":{"field":"price.price","interval":1,"min_doc_count":1}}}}}},"option_text_sport_type":{"terms":{"field":"option_text_sport_type.untouched","size":10,"order":{"_count":"desc"}}},"option_text_club":{"terms":{"field":"option_text_club.untouched","size":10,"order":{"_count":"desc"}}},"option_text_club_country":{"terms":{"field":"option_text_club_country.untouched","size":10,"order":{"_count":"desc"}}},"option_text_league":{"terms":{"field":"option_text_league.untouched","size":10,"order":{"_count":"desc"}}}},"track_total_hits":true}' [] []
Default category based on virutal rule club = 5491:
[2022-09-22 09:24:22] .INFO: Request Success: {"method":"HEAD","uri":"http://elasticsearch7/magento2_default_catalog_product","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.001895} []
[2022-09-22 09:24:22] .INFO: curl -XHEAD 'http://elasticsearch7/magento2_default_catalog_product?pretty=true' [] []
[2022-09-22 09:24:23] .INFO: Request Success: {"method":"HEAD","uri":"http://elasticsearch7/magento2_voetbalzonenl_catalog_product","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.001085} []
[2022-09-22 09:24:23] .INFO: curl -XHEAD 'http://elasticsearch7/magento2_voetbalzonenl_catalog_product?pretty=true' [] []
[2022-09-22 09:24:23] .INFO: Request Success: {"method":"GET","uri":"http://elasticsearch7/","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.000557} []
[2022-09-22 09:24:23] .INFO: curl -XGET 'http://elasticsearch7/?pretty=true' [] []
[2022-09-22 09:24:23] .INFO: Request Success: {"method":"GET","uri":"http://elasticsearch7/","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.000322} []
[2022-09-22 09:24:23] .INFO: curl -XGET 'http://elasticsearch7/?pretty=true' [] []
[2022-09-22 09:24:23] .INFO: Request Success: {"method":"POST","uri":"http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.001677} []
[2022-09-22 09:24:23] .INFO: curl -XPOST 'http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search?pretty=true' -d '{"size":0,"query":{"constant_score":{"filter":{"bool":{"must":[{"bool":{"must":[{"terms":{"club":["5491"],"boost":1}}],"must_not":[],"should":[],"boost":1}},{"terms":{"visibility":[2,4],"boost":1}},{"bool":{"must_not":[{"nested":{"path":"category","score_mode":"none","query":{"bool":{"must":[{"term":{"category.category_id":{"value":53,"boost":1}}},{"term":{"category.is_blacklisted":{"value":true,"boost":1}}}],"must_not":[],"should":[],"boost":1}},"boost":1}}],"boost":1}},{"terms":{"visibility":[2,4],"boost":1}}],"must_not":[],"should":[],"boost":1}},"boost":1}},"aggregations":{"attribute_set_id":{"terms":{"field":"attribute_set_id","size":100000,"order":{"_count":"desc"}}},"indexed_attributes":{"terms":{"field":"indexed_attributes","size":100000,"order":{"_count":"desc"}}}},"track_total_hits":true}' [] []
[2022-09-22 09:24:23] .INFO: Request Success: {"method":"POST","uri":"http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.002012} []
[2022-09-22 09:24:23] .INFO: curl -XPOST 'http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search?pretty=true' -d '{"size":0,"query":{"constant_score":{"filter":{"bool":{"must":[{"bool":{"must":[{"terms":{"club":["5491"],"boost":1}}],"must_not":[],"should":[],"boost":1}},{"terms":{"visibility":[2,4],"boost":1}},{"bool":{"must_not":[{"nested":{"path":"category","score_mode":"none","query":{"bool":{"must":[{"term":{"category.category_id":{"value":53,"boost":1}}},{"term":{"category.is_blacklisted":{"value":true,"boost":1}}}],"must_not":[],"should":[],"boost":1}},"boost":1}}],"boost":1}},{"terms":{"visibility":[2,4],"boost":1}}],"must_not":[],"should":[],"boost":1}},"boost":1}},"aggregations":{"attribute_set_id":{"terms":{"field":"attribute_set_id","size":100000,"order":{"_count":"desc"}}},"indexed_attributes":{"terms":{"field":"indexed_attributes","size":100000,"order":{"_count":"desc"}}},"price.price":{"nested":{"path":"price"},"aggregations":{"price.price":{"filter":{"terms":{"price.customer_group_id":[0],"boost":1}},"aggregations":{"price.price":{"histogram":{"field":"price.price","interval":1,"min_doc_count":1}}}}}},"option_text_sport_type":{"terms":{"field":"option_text_sport_type.untouched","size":10,"order":{"_count":"desc"}}},"option_text_club":{"terms":{"field":"option_text_club.untouched","size":10,"order":{"_count":"desc"}}},"option_text_club_country":{"terms":{"field":"option_text_club_country.untouched","size":10,"order":{"_count":"desc"}}},"option_text_league":{"terms":{"field":"option_text_league.untouched","size":10,"order":{"_count":"desc"}}}},"track_total_hits":true}' [] []
[2022-09-22 09:24:23] .INFO: Request Success: {"method":"POST","uri":"http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.001732} []
[2022-09-22 09:24:23] .INFO: curl -XPOST 'http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search?pretty=true' -d '{"size":0,"query":{"constant_score":{"filter":{"bool":{"must":[{"bool":{"must":[{"terms":{"club":["5491"],"boost":1}}],"must_not":[],"should":[],"boost":1}},{"terms":{"visibility":[2,4],"boost":1}},{"bool":{"must_not":[{"nested":{"path":"category","score_mode":"none","query":{"bool":{"must":[{"term":{"category.category_id":{"value":53,"boost":1}}},{"term":{"category.is_blacklisted":{"value":true,"boost":1}}}],"must_not":[],"should":[],"boost":1}},"boost":1}}],"boost":1}},{"terms":{"visibility":[2,4],"boost":1}}],"must_not":[],"should":[],"boost":1}},"boost":1}},"aggregations":{"attribute_set_id":{"terms":{"field":"attribute_set_id","size":100000,"order":{"_count":"desc"}}},"indexed_attributes":{"terms":{"field":"indexed_attributes","size":100000,"order":{"_count":"desc"}}}},"track_total_hits":true}' [] []
[2022-09-22 09:24:23] .INFO: Request Success: {"method":"POST","uri":"http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search","port":9200,"headers":{"Host":["elasticsearch7"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/7.7.0 (Linux 5.15.0-47-generic; PHP 7.4.29)"]},"HTTP code":200,"duration":0.005121} []
[2022-09-22 09:24:23] .INFO: curl -XPOST 'http://elasticsearch7/magento2_voetbalzonenl_catalog_product/_search?pretty=true' -d '{"size":10000,"sort":[{"ticket_valid_from":{"order":"asc","missing":"_last","unmapped_type":"keyword"}},{"_score":{"order":"desc"}},{"entity_id":{"order":"desc","missing":"_first","unmapped_type":"keyword"}}],"from":0,"query":{"constant_score":{"filter":{"bool":{"must":[{"bool":{"must":[{"terms":{"club":["5491"],"boost":1}}],"must_not":[],"should":[],"boost":1}},{"terms":{"visibility":[2,4],"boost":1}},{"bool":{"must_not":[{"nested":{"path":"category","score_mode":"none","query":{"bool":{"must":[{"term":{"category.category_id":{"value":53,"boost":1}}},{"term":{"category.is_blacklisted":{"value":true,"boost":1}}}],"must_not":[],"should":[],"boost":1}},"boost":1}}],"boost":1}},{"terms":{"visibility":[2,4],"boost":1}}],"must_not":[],"should":[],"boost":1}},"boost":1}},"aggregations":{"attribute_set_id":{"terms":{"field":"attribute_set_id","size":100000,"order":{"_count":"desc"}}},"indexed_attributes":{"terms":{"field":"indexed_attributes","size":100000,"order":{"_count":"desc"}}},"price.price":{"nested":{"path":"price"},"aggregations":{"price.price":{"filter":{"terms":{"price.customer_group_id":[0],"boost":1}},"aggregations":{"price.price":{"histogram":{"field":"price.price","interval":1,"min_doc_count":1}}}}}},"option_text_sport_type":{"terms":{"field":"option_text_sport_type.untouched","size":10,"order":{"_count":"desc"}}},"option_text_club":{"terms":{"field":"option_text_club.untouched","size":10,"order":{"_count":"desc"}}},"option_text_club_country":{"terms":{"field":"option_text_club_country.untouched","size":10,"order":{"_count":"desc"}}},"option_text_league":{"terms":{"field":"option_text_league.untouched","size":10,"order":{"_count":"desc"}}}},"track_total_hits":true}' []
So its clear to me now that the virtual rules are missing in the query. Question now is, why are they missing?
Do you go through this line ? https://github.com/Smile-SA/elasticsuite/blob/2.10.x/src/module-elasticsuite-virtual-category/Plugin/Collection/AddVirtualCategoryQuery.php#L53
@WouterSteen,
IMHO, adding custom blocks with products via an XML file is not the best practice. Every time you want to make some changes you will need to update your XML file and then deploy it to your server or smth like that.
Why do you not use creating a new Block or Widgets with Page Builder via Magento BO?


And then with adding this block or widgets to wherever you want.
BR, Vadym
Why would this not be a best practice, its the exact same way as magento does it.
When implementing page builder or similar you have exactly the same problems when you want to edit something. You have to style the widget etc.
@vahonc we don't like using the GUI for adding blocks;
- Less flexibility since we can only use what the editor gives us for options
- The client might have the possibility to edit the blocks, which we don't want
- No version control since it is stored in the database instead of in Git
- Like @WouterSteen says, whether you create a block there or in the code, you still need to write code to style the widget. So it's better to the it both in code, instead of one in the database and the other in the code. That way, the changes are in one commit and you have a better paper trail of what happened.
- Editing and deploying is exactly what we want - the linting in our pipeline makes sure we don't deploy stuff we don't want in there.
Anyway, off topic, since it does not answer the issue outlined here.
Do you go through this line ? https://github.com/Smile-SA/elasticsuite/blob/2.10.x/src/module-elasticsuite-virtual-category/Plugin/Collection/AddVirtualCategoryQuery.php#L53
Will look into this ! Thanks
This issue was waiting update from the author for too long. Without any update, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away! Thanks for your contribution.