Smile-SA / elasticsuite

Smile ElasticSuite - Magento 2 merchandising and search engine built on ElasticSearch
https://elasticsuite.io
Open Software License 3.0
760 stars 339 forks source link

The ability to apply optimizer to every category except some. #2766

Open Hexmage opened 1 year ago

Hexmage commented 1 year ago

Is your feature request related to a problem? Please describe. Currently it's only possible to apply optimizer to all all categories or some selected categories. I currently have a client who has over 1000 categories and wants to apply a booster to all categories except a couple of specific ones. Currently you'd have to select 999+ categories by hand to exclude it from one.

Describe the solution you'd like Screenshot from 2022-10-27 15-39-28 A All but Selected Categories in this dropdown.

Additional context The currently implementation doesn't easily allow for this logic to be implemented.

vahonc commented 1 year ago

Hello @Hexmage

We will try to take this into account in our future releases.

BR, Vadym

Hexmage commented 1 year ago

@romainruaud I see that this was given a priority tag. Is there any indication of a timeline?

romainruaud commented 1 month ago

@vahonc can you work on this ?

  1. Add a "All but Selected Categories" in this dropdown, selecting it should display the Category dropdown. The value associated to this option should be "2" and choosing it should display the Category selector : https://github.com/Smile-SA/elasticsuite/blob/2.11.x/src/module-elasticsuite-catalog-optimizer/view/adminhtml/ui_component/smile_elasticsuite_catalog_optimizer_form.xml#L560

  2. Save the data in the appropriate table. The data should contain :

  1. Ensure the boosts are properly applied in Front-Office on all categories except the selected. You should probably add something like "OR (osc.apply_to = 2 AND main_table.{$column} != ?)" to this line : https://github.com/Smile-SA/elasticsuite/blob/2.11.x/src/module-elasticsuite-catalog-optimizer/Model/ResourceModel/Optimizer/Limitation.php#L137

  2. Investigate if the legacy caching mechanism is OK with this new "all categories but selected" mechanism : https://github.com/Smile-SA/elasticsuite/blob/2.11.x/src/module-elasticsuite-catalog-optimizer/Model/Optimizer/Limitation/Identities.php#L143