[ 
https://issues.apache.org/jira/browse/OAK-1215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13832596#comment-13832596
 ] 

Jeff Young commented on OAK-1215:
---------------------------------

The property searches are usually AND'ed with other searches, so traversal only 
entails filtering of the hits which matched the other constraints.  This is 
what I timed at ~ 6X slower.

There's a large body of code in CQ which sits between the (customer-authored) 
predicates and the XPath.  All of that would have to be updated to pass the 
query through SQL-2 instead of XPath.  (Or perhaps you meant translating the 
XPath to SQL-2 inside Oak?)

The query you wrote is very different, as it returns the nodes that the 
properties are on.  In the commerce case, products are hierarchically defined 
by the customer (given their product "schema").  So we don't know what the 
properties are, or how deep they are.  Instead, we allow authors to specify 
just the property name and the depth they want to search.  But the search needs 
to return the product, not the sub-nodes.  

If an author says "search for products where 'size' is 'M' up to a depth of 
'2'" (ie: the geometrixx-outdoors product schema), the query will look 
something like:

{code:xml}
/jcr:root/etc/commerce/products//*[@cq:commerceType='product' and (@size='M' or 
*/@size='M' or */*/@size='M')]
{code}

Supporting this via XPath's {{descendant-or-self::}} axis would have made the 
most sense, but that's water under the bridge (as Jackrabbit 2 doesn't support 
it), which is why we use the long-hand {{@prop or \*/@prop or \*/\*/@prop}} 
(with an author-supplied depth).

Keep in mind that existing projects likely already have these searches defined 
in CQ5.6 and 5.6.1.

> Relative property paths don't work in XPath search expressions
> --------------------------------------------------------------
>
>                 Key: OAK-1215
>                 URL: https://issues.apache.org/jira/browse/OAK-1215
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>            Reporter: Jeff Young
>            Priority: Critical
>         Attachments: relative-predicate-paths.tiff
>
>
> A search XPath of the form:
> {code}
> /jcr:root/etc/commerce/products//*[@size='M' or */@size='M']
> {code}
> returns:
> {code}
> Invalid path: *
> {code}
> (This works fine in Jackrabbit.)



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to