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
feat(api): Not operator for filtering facet values when using 'search' and MySQL #2685
base: minor
Are you sure you want to change the base?
feat(api): Not operator for filtering facet values when using 'search' and MySQL #2685
Conversation
Hi, thanks for bearing with me. I've now had some time to take a look at this PR. To test the behaviour, I wrote some e2e tests which you can see here: 870dc70 3 of the tests pass, but the It uses the following input:
I am expecting this to be interpreted as "where the product does not have facet value ID T_1 AND does not have facet value ID T_2". That is, return all the products (from this csv file) which do not have both the "electronics" (T_1) and "computer" (T_2) facet values. The result I am getting upon running the tests when in the
i.e., the 4 "photo" products are not being returned, even though they do not have both the "electronics" and "computer" facet values - they have "electronics" and "photo". Can you take a look at this - is my assumption about the input for this query correct? Did I overlook anything? |
Hi! No problem, thank you for providing such a detailed description of the issue. I agree with your interpretation and that the behavior is unexpected. I've looked into this by running our Vendure fork locally (v2.2.0-next3) and I see some strange results in the generated query. First of all, I don't have the facet value ids "T_1" or "T_2", only numeric values. I'm using What happens is that the parameters are set to "-1" if I provide a string value to the facet value id filter, for example:
Parameters:
(just one parameter when it should be two) But if I provide only numbers instead:
The parameters are set to:
I'm simply logging the values via Unless I've done something wrong with my local setup, perhaps this is the reason? In that case, any other passing tests may be false positives. |
Description
Support for a "not" operator for filtering facet values on the
search
query when using MySQL. The "not" operator is used together with AND or OR, but not both at the same time - in the same way they currently work.New GraphQL type:
The FacetValueFilterInput type is extended like so:
Usage example:
Breaking changes
No.
Screenshots
.
Checklist
📌 Always:
👍 Most of the time: