[MGNLPN-221] SegmentationMultiField: segment relation validation based on path comparison causes false-positives Created: 02/Jul/15  Updated: 21/Jul/15  Resolved: 09/Jul/15

Status: Closed
Project: Magnolia Personalization
Component/s: None
Affects Version/s: None
Fix Version/s: 1.1.3

Type: Bug Priority: Neutral
Reporter: Robert Mikoda Assignee: Antonín Juran
Resolution: Fixed Votes: 0
Labels: support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
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:
Visible to:
Benoit Olbrechts, David Wartel, Gregory Vandenbroucke, Hugo Venancio, Robert Mikoda
Sprint: Sprint 2 (Basel)
Story Points: 1

 Description   

When validating the segments Magnolia seems to check if any two of selected segments share the same starting path
In SegmentationMultiField

            Node node2 = session.getNodeByIdentifier(uuid2);
            if (node1.getPath().equals(node2.getPath())) {
                return false;
            }
            if (StringUtils.startsWith(node1.getPath(), node2.getPath())) {
                return false;
            }
            if (StringUtils.startsWith(node2.getPath(), node1.getPath())) {
                return false;
            }
        }

I two last checks if the first segment is parent of the second one fail when the name of the first segment start with the name of the second segment (and vice versa):

  • StringUtils.startsWith(node1.getPath(), node2.getPath())
  • StringUtils.startsWith(node2.getPath(), node1.getPath())

Otherwise if one defines and select segments like:

  • FOO
  • FOO+BAR
    It will result in a validation error


 Comments   
Comment by Roman Kovařík [ 09/Jul/15 ]

Reopened:
The check for parent is not enough since you can have more nested segments (grandparent/parent/child).You could use info.magnolia.jcr.util.NodeUtil#getAncestors to do the check,

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