[MGNLGQL-55] Limit and offset arguments are not behaving correctly Created: 20/Oct/20 Updated: 16/Nov/20 Resolved: 03/Nov/20 |
|
| Status: | Closed |
| Project: | Magnolia GraphQL |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Ondrej Chytil | Assignee: | Jaroslav Simak |
| Resolution: | Fixed | 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: | |
| Epic Link: | GraphQL Phase 1 |
| Sprint: | HL & LD 14, HL & LD 15 |
| Story Points: | 3 |
| Description |
|
Reproduction steps:
Eg.: |
| Comments |
| Comment by Jaroslav Simak [ 20/Oct/20 ] |
|
This is caused by how the JCR query is using limit and offset with localized subModel, JOIN and RowIterator – Localized subModel leads into having two nodes under the model, example: /myModel /myModel/mySubModel /myModel/mySubModel_de The RowIterator will return N sub nodes (where N is number of locales under the main node), making limit and offset behave incorrectly for our use case. We can use NAME operand in the WHERE clause to force child nodes to a certain name (name of the subModel in our case). Here's a working snippet from Groovy with NAME operand (position is localized): def sess = ctx.getJCRSession("books") def query = "SELECT * FROM [lib:book] AS t LEFT OUTER JOIN [mgnl:contentNode] AS ch0 ON ISCHILDNODE(ch0, t) WHERE NAME(ch0) = 'position'" def result = sess.getWorkspace().getQueryManager().createQuery(query, "JCR-SQL2").execute(); def iterator = result.getRows() iterator.each { row -> println row } Above query will not produce ambiguous result that is based on number of locales saved under the main node. |