Query Builder Implementation | Community
Skip to main content
Murali89
Level 2
May 19, 2016
Solved

Query Builder Implementation

  • May 19, 2016
  • 1 reply
  • 1114 views

Is there a way i can search if any property's value on any node on JCR contains a specific value. EX : I want to get all the nodes which has some propery whose value contains a string "Sample".

I know there is something called "fulltext" property but how do i specify multiple values in the predicate for "type" property as any node whose type can be nt:unstructured, cq:page,cq:pageContent etc can contain the value which contains a string "sample".

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

Hi 

Please have a look at this reference article for your help:-

Link:- http://aempodcast.com/2015/aem-resources/aem-queries-xpath-jcr-sql2-query-builder-syntaxes/#.V0QAaPl97RY (point 3)

//

Use fulltext="specific value"

Example:-

Find all nodes under /content where some property contains the string “pants”

  • Query Builder:
         
    1
    2
    path=/content
    fulltext=pants
     
  • XPath
         
    1
    /jcr:root/content//element(*)[jcr:contains(@*, 'pants')]

     

  • JCR-SQL2:
         
    1
    2
    3
    SELECT * from [nt:base] AS t
    where ISDESCENDANTNODE('/content') and
          contains(t.*, 'pants')

 

I hope this will help you.

Thanks and Regards

Kautuk Sahni

1 reply

kautuk_sahni
Community Manager
kautuk_sahniCommunity ManagerAccepted solution
Community Manager
May 24, 2016

Hi 

Please have a look at this reference article for your help:-

Link:- http://aempodcast.com/2015/aem-resources/aem-queries-xpath-jcr-sql2-query-builder-syntaxes/#.V0QAaPl97RY (point 3)

//

Use fulltext="specific value"

Example:-

Find all nodes under /content where some property contains the string “pants”

  • Query Builder:
         
    1
    2
    path=/content
    fulltext=pants
     
  • XPath
         
    1
    /jcr:root/content//element(*)[jcr:contains(@*, 'pants')]

     

  • JCR-SQL2:
         
    1
    2
    3
    SELECT * from [nt:base] AS t
    where ISDESCENDANTNODE('/content') and
          contains(t.*, 'pants')

 

I hope this will help you.

Thanks and Regards

Kautuk Sahni

Kautuk Sahni