[MGNLREST-120] Implement filtering operators Created: 04/Oct/17 Updated: 09/Jan/18 Resolved: 06/Jan/18 |
|
| Status: | Closed |
| Project: | Magnolia REST Framework |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 2.0.2 |
| Type: | New Feature | Priority: | Neutral |
| Reporter: | Hieu Nguyen Duc | Assignee: | Hieu Nguyen Duc |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | 0d | ||
| Time Spent: | 4.25d | ||
| Original Estimate: | 4d | ||
| Issue Links: |
|
||||||||||||||||
| Template: |
|
||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||
| Documentation update required: |
Yes
|
||||||||||||||||
| Date of First Response: | |||||||||||||||||
| Epic Link: | REST Queries | ||||||||||||||||
| Sprint: | Saigon 126, Saigon 127, Saigon 128, Saigon 129 | ||||||||||||||||
| Story Points: | 5 | ||||||||||||||||
| Description |
|
Query params are parsed as key=value, so the operator needs to be included on either side of the equal sign. Contentful does the it with bracket operators on the key side (see reference); /spaces/{space_id}/entries?{property}[gte]={value}
=> filter where "property" is greater than or equal to "value" |
| Comments |
| Comment by Mikaël Geljić [ 15/Dec/17 ] |
|
High-level flavor
Operator syntax
Comparators
Range operators
Negation operator
Date filtering
Partial string matching
Allow to define custom operators?
The issue with tours duration
Examples …?location[ne]=Basel …?duration=7 …?duration>=7 //confusing …?duration>==7 //equally confusing …?duration[gte]=7&duration[lte]=14 //possible, not best …?duration[in]=7~14 …?duration[not-in]=7~14 …?duration[eq]=7 //should be equivalent to …?duration=7 …?duration[ne]=7 …?startDate=2017-12-15 …?startDate[gte]=2017-12-15 …?startDate[in]=2017-12-00~2017-12-15 |
| Comment by Mikaël Geljić [ 15/Dec/17 ] |
|
Goal for next week is to:
|
| Comment by Hieu Nguyen Duc [ 08/Jan/18 ] |
|
The final scope of this ticket is described in Concept page. |
| Comment by Ngoc Nguyenthanh [ 09/Jan/18 ] |
|
Date format should remain consistent across operators. Now it works differently between gt vs lt |
| Comment by Hieu Nguyen Duc [ 09/Jan/18 ] |
|
If the input date format is not correct, it defaults to String comparison and output result is unpredictable. + [gt] case SELECT t.* FROM [nt:base] AS t WHERE t.[jcr:primaryType] = 'mgnl:page' AND t.[mgnl:created] > '2017-1-1' ORDER BY LOWER(NAME(t)) + [lt] case SELECT t.* FROM [nt:base] AS t WHERE t.[jcr:primaryType] = 'mgnl:page' AND t.[mgnl:created] < '2017-1-1' ORDER BY LOWER(NAME(t)) |