[MGNLREST-302] Delivery endpoint, filtering by @name not working properly Created: 12/Apr/21  Updated: 18/May/21  Resolved: 13/Apr/21

Status: Closed
Project: Magnolia REST Framework
Component/s: None
Affects Version/s: 2.2.6
Fix Version/s: 2.2.7

Type: Bug Priority: Neutral
Reporter: Carlos Cantalapiedra Assignee: Mikaël Geljić
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Date of First Response:

 Description   

Steps to reproduce

  1.  Define a basic endpoint like the following:
    class: info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpointDefinition
    workspace: website
    bypassWorkspaceAcls: true
    depth: 5
    nodeTypes:
     - mgnl:page
     - mgnl:area
    childNodeTypes:
     - mgnl:component
  1. On the website workspace, create two pages, test and Test.
  2. Perform the rest request
    SELECT t.* FROM [nt:base] AS t WHERE ((t.[jcr:primaryType] = 'mgnl:page') OR (t.[jcr:primaryType] = 'mgnl:area')) AND (LOWER(LOCALNAME(t)) like 'Test') 
  3. Check no results are returned

Expected results

Only the Test page is returned

Actual results

No results are returned

Workaround

N/A

Development notes

Performing the request

SELECT t.* FROM [nt:base] AS t WHERE ((t.[jcr:primaryType] = 'mgnl:page') OR (t.[jcr:primaryType] = 'mgnl:area')) AND (LOWER(LOCALNAME(t)) like 'test')

also returns incorrect values, instead of returning only the test page, it returns both, Test and test:

{
    "results": [
        {
            "@name": "Test",
            "@path": "/Test",
            "@id": "093dae11-6506-4a7b-961f-3af35fcb58ac",
            "@nodeType": "mgnl:page",
            "title": "Test with capital",
            "hideInNav": "false",
            "noCache": "false",
            "@nodes": []
        },
        {
            "@name": "test",
            "@path": "/test",
            "@id": "ab9f7eb7-450a-41d6-9e99-98dd9b5066b6",
            "@nodeType": "mgnl:page",
            "title": "test in lowercase",
            "hideInNav": "false",
            "noCache": "false",
            "@nodes": []
        }
    ]
}

Full details and example on support ticket 12890.



 Comments   
Comment by Mikaël Geljić [ 12/Apr/21 ]

also returns incorrect values, instead of returning only the test page, it returns both, Test and test

—Proposed fix is to make the @name search case-insensitive, aligning with full-text search on regular properties. So the 2 results being returned looks as expected. Feel free to chime back if there's a strong case for case-sensitive search, that would be a slightly larger improvement (configurability) than this fix.

Generated at Mon Feb 12 06:58:35 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.