-
Notifications
You must be signed in to change notification settings - Fork 9.4k
SearchCriteria too limited in AND/OR filtering #4060
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
Comments
@choukalos can you take a look at this one Chuck? |
Ability to specify nested and/or logic, see above example. |
Thanks @samtay for the insight. We're tracking internally. For those on this thread, a change to search criteria would be a breaking change; how big of an impact would this be for you all? |
@choukalos What do you mean by breaking change? If it breaks the search criteria so it doesn't work that would have a very negative impact. But maybe I don't fully understand the question you are asking. |
Thank you for your submission. We recently made some changes to the way we process GitHub submissions to more quickly identify and respond to core code issues. Feature Requests and Improvements should now be submitted to the new Magento 2 Feature Requests and Improvements forum (see details here). We are closing this GitHub ticket and have moved your request to the new forum. |
From what I understand, filters are combined with an OR logic within a particular filter group, and filter groups are combined with AND logic within search criteria. This is unfortunately not listed in documentation, but is what users on stackoverflow have discovered.
This is very limiting. For example, it is impossible to filter the product repository by two date intervals: suppose I want to grab all the products that are either new or on sale. This would involve logic like so:
But this is impossible to build as searchCriteria. The outer OR would dictate that everything needs to be in one filter group, but within each interval we also need AND combinations, which are impossible within one filter group. Because of these limitations, I have been forced to use collections directly instead of using the repository abstraction layer. Please let me know if there is a more flexible way to have and/or combinations.
The text was updated successfully, but these errors were encountered: