Skip to main content
Level 2
Oct 16, 2015 2:27 AM UTC
Solved

Using regex in SQL2

Hi,

Is there a way I can use regex or something similar to narrow down the number of nodes across which a query will search to find the results.

I am currently using like this:

SELECT * FROM [dam:Asset] AS s WHERE ISDESCENDANTNODE(s,'/content/dam/a') and [jcr:content/metadata/sku]='XYZ'

However I know my actual nodes are 3 levels deeper than /content/dam/a like /content/dam/a/b/c/product, /content/dam/a/d/e/product etc.

So I would like to do something like this:

SELECT * FROM [dam:Asset] AS s WHERE ISDESCENDANTNODE(s,'/content/dam/a/*/product') and [jcr:content/metadata/sku]='XYZ'

Let me know if this is possible without using multiple paths in the where condition. This will also improve the performance of my query as it will restrict the query to fewer folders.

Thanks,Souradeep

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
gopalKaAccepted solution
Adobe Employee
Oct 16, 2015 2:27 AM UTC

Please read through http://docs.adobe.com/docs/en/aem/6-0/deploy/upgrade/queries-and-indexing.html#Configuring%20the%20indexes .Find a unique property through which you can identify your nodes and index it.

11 replies

Adobe Employee
Oct 16, 2015 2:27 AM UTC

Why dont you index tht property rather than regex.It will be much faster.

Translate