Expand my Community achievements bar.

SOLVED

Fulltext query on subnodes doesn't work- XPath & Query Builder

Avatar

Level 1

I'm trying to perform a query on the CRX of a 6.2 Adobe AEM version.

I have to execute a fulltext query on all subnodes of /content/connect/it/supplier/<aNode>/jcr:content/service/legal where <aNode> is a generic node1, node2, node3 (and so on) as you can see in the following picture:

JCR_OAK.png

To achive my target I tried using this XPath query (generated using the query builder):

/jcr:root/content/connect/it/supplier//*[jcr:contains(jcr:content/service/legal, "helloWorld")]

but it does not work, it does not retrieve anything. In fact, I have just realized that with the previous query I am able to search for the properties of jcr:content/service/legal node.

Then I tried using somethig like:

/jcr:root/content/connect/it/supplier//*[jcr:contains(jcr:content/service/legal//*/[@attributeName="helloWorld"])]

but this time my query was not right.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

Can you try like below:

/jcr:root/content/connect/it/supplier//element(*, nt:unstructured)[(jcr:contains(., 'helloWorld')) ]

/jcr:root/content/connect/it/supplier//element(*, nt:unstructured)[(jcr:contains(service/legal/@attributeName, 'helloWorld')) ]

Example from we retail

/jcr:root/content/we-retail/language-masters//element(*, nt:unstructured)

[

(jcr:contains(., 'Men'))

]

/jcr:root/content/we-retail/language-masters//element(*, nt:unstructured)

[

(jcr:contains(button/@label, 'Men'))

]



Arun Patidar

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi,

Can you try like below:

/jcr:root/content/connect/it/supplier//element(*, nt:unstructured)[(jcr:contains(., 'helloWorld')) ]

/jcr:root/content/connect/it/supplier//element(*, nt:unstructured)[(jcr:contains(service/legal/@attributeName, 'helloWorld')) ]

Example from we retail

/jcr:root/content/we-retail/language-masters//element(*, nt:unstructured)

[

(jcr:contains(., 'Men'))

]

/jcr:root/content/we-retail/language-masters//element(*, nt:unstructured)

[

(jcr:contains(button/@label, 'Men'))

]



Arun Patidar