Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual rules not working as expected #3439

Open
Calvin495 opened this issue Nov 9, 2024 · 3 comments
Open

Virtual rules not working as expected #3439

Calvin495 opened this issue Nov 9, 2024 · 3 comments
Assignees

Comments

@Calvin495
Copy link

We have been using the Elasticsuite in our Adobe Commerce (Magento EE) store. We have configured the virtual rules in the category, but we have been noticing that these rules may not be working properly. We see the products in the category even though they do not fulfill the virtual rule conditions.

Preconditions

Magento EE Version : 2.4.5 (Adobe Commerce Cloud)
ElasticSuite Version : 2.10.18.2
Environment : Production

Steps to reproduce

  1. Go to Catalog > Catagories and edit any category in the admin
  2. Enable the virtual category, configure the virtual rule condition, and save the category
  3. Check the category page on the front end

Expected result

  1. The category should show the products that match the virtual rule conditions

Actual result

  1. The category page shows the products that do not match the rule conditions

Take a look at the screenshots below.

2024-11-09_095845

2024-11-09_095615

We also tried to do the re-index manually several times, but that didn't change anything.

@vahonc
Copy link
Collaborator

vahonc commented Nov 13, 2024

Hi @Calvin495,

You're most likely having this issue because you're using virtual categories to create a complete category tree (virtual categories that have virtual children that also reference other categories elsewhere). Therefore, your problematic product came from the children's category.

You have to keep in mind that when computing category/product association for a high-level category (or the search result page), the engine will build a complex query to assemble all the products belonging to the currently viewed category:

  • products belonging to non-virtual children of the current category
  • products matching one of any virtual children of the current category

The resulting query could end up being quite complex and adding pressure to the computation mechanism done by Elasticsearch. That’s why, due to the current situation, we strongly recommend not using them for the whole category tree.

That's not the purpose behind virtual categories: they are designed to build ephemeral categories, such as dynamic corners: "special father day", "actually discounted products", "new products" or a category based on something that will often change: discount, stock, total number of sales, etc…

The good news is that we have plans to implement some changes that in the future will make virtual categories easier to use in some cases or let our customers decide how they want to use them.

BR,
Vadym

@Calvin495
Copy link
Author

@vahonc

Yes, we have virtual parent and child categories. Do you mean that because we have most of the parent and child categories as virtual categories, the search engine is building a complex query to gather products literally from all other categories?

@vahonc
Copy link
Collaborator

vahonc commented Nov 18, 2024

@Calvin495,

Yes, that's what I meant. Virtual categories are supposed to be used for limited, marketing oriented merchandising operations, but NOT to be used as the foundations for a catalog. And, as I also mentioned in my comment we have plans to implement some changes.

BR,
Vadym

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants