[MGNLREST-321] Delivery API - Filter nodes by by category of nested node Created: 02/Aug/21 Updated: 04/Apr/22 |
|
| Status: | Accepted |
| Project: | Magnolia REST Framework |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Story | Priority: | Neutral |
| Reporter: | Henry Steinberg | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| 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)
|
||||||||
| Date of First Response: | |||||||||
| Description |
|
User story: as a developer I want to be able to filter nodes by the @name value of a nested category node. E.G. for the following result I would like to filter only for nodes where primaryCategory[@name] is equal to recipes". // { "results": [{ "@name": "dried-mulberry-recipes", "@path": "/health-hub/uk/the-health-hub/2020/m09/dried-mulberry-recipes", "@id": "37bb2fa5-164d-48c6-b5ef-d521daf21926", "@nodeType": "mgnl:page", "visibleInCategories": ["3a2a906b-16da-4ff4-9501-ad14b8d209a9"], "wpCreationDate": "2020-09-07T15:20:53.000Z", "primaryCategory": { "@name": "recipes", "@path": "/health-hub/uk/the-health-hub/food-drink/recipes", "@id": "7a92bba1-aeeb-41e0-bfbe-b03811100ec0", "@nodeType": "mgnl:category", "apple-cider-vinegar-recipes": { "@name": "apple-cider-vinegar-recipes", "@path": "/health-hub/uk/the-health-hub/food-drink/recipes/apple-cider-vinegar-recipes", "@id": "1f500e5e-21e0-4168-a664-9d06ea8ad54f", "@nodeType": "mgnl:category", "@nodes": [] }, "@nodes": ["apple-cider-vinegar-recipes"] }, "@nodes": [] }, { "@name": "best-vegan-and-vegetarian-protein-sources", "@path": "/health-hub/uk/the-health-hub/2020/m09/best-vegan-and-vegetarian-protein-sources", "@id": "0dad76fb-7580-4f71-aff8-dd19238dd537", "@nodeType": "mgnl:page", "visibleInCategories": ["177bc7ee-3da2-47c8-a00a-52073fd09113"], "wpCreationDate": "2020-09-07T16:19:21.000Z", "primaryCategory": { "@name": "vegan", "@path": "/health-hub/uk/the-health-hub/food-drink/diets/vegan", "@id": "df9b79fd-79cc-403b-a184-128a9c6d8952", "@nodeType": "mgnl:category", "vegan-your-way": { "@name": "vegan-your-way", "@path": "/health-hub/uk/the-health-hub/food-drink/diets/vegan/vegan-your-way", "@id": "785cc6c5-b63b-4c75-b7f9-fd86ab195daf", "@nodeType": "mgnl:category", "@nodes": [] }, "@nodes": ["vegan-your-way"] }, "@nodes": [] }] }
|
| Comments |
| Comment by Christopher Zimmermann [ 02/Aug/21 ] |
|
Workaround: It is possible to filter based on the uuid of the categories. Your frontend can keep the uuid's of all of the categories that it loads. So then when a user wants to filter on categories, you can use the uuid's in your API request. Does this solve your usecase or is there some problem with the above approach? Or is it more a matter of convenience? |
| Comment by Henry Steinberg [ 02/Aug/21 ] |
|
I had considered something like that as a work around, but I was hoping there was a less hacky way to get it done as we are working with over 100 categories and new ones are being added all the time. |
| Comment by Christopher Zimmermann [ 04/Apr/22 ] |
|
Is primaryCategory actually storing a refernce to another node... and you want to filter on a property of a referenced node? Or is primaryCategory an actual JCR child of the dried-mulberry-recipe node? |