[MGNLREST-351] Filtering with operation "contains-any" Created: 15/Mar/22 Updated: 25/Jan/23 |
|
| Status: | Accepted |
| Project: | Magnolia REST Framework |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Davis Chung | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
| Date of First Response: |
| Description |
|
Let say I have a product node with field categories as below "categories": [ "98a69699-0acd-4d8d-b743-9d9fb2b9830a", "ae5dae88-488b-43ac-b857-b142d2fa3c33" ], With url http://localhost:8080/magnoliaAuthor/.rest/delivery/products?categories=98a69699-0acd-4d8d-b743-9d9fb2b9830a&categories=ae5dae88-488b-43ac-b857-b142d2fa3c33 & [http://localhost:8080/magnoliaAuthor/.rest/delivery/products?categories[eq]=98a69699-0acd-4d8d-b743-9d9fb2b9830a&categories[eq]=ae5dae88-488b-43ac-b857-b142d2fa3c33], we could filter out products which contains at least these 2 categoryIds. To achieve the "contains-any" operation, we try to negate the OR operation to AND-NOT-EQUAL operation with below url http://localhost:8080/magnoliaAuthor/.rest/delivery/products?categories[ne]=00000000-0000-0000-0000-000000000000, however, no products could be returned from such rest url. Seems a bit strange for the [eq] operator working on the uuid-list field while [ne] is not. Would like to know if any chance there is an already-built function where we could achieve such use case. Please advise and thanks. |
| Comments |
| Comment by Mykola [ 25/Jan/23 ] |
|
Maybe pipe operator is what you looking for: Docs: https://docs.magnolia-cms.com/product-docs/6.2/Developing/API/Delivery-API.html#_usage_notes_on_filtering |