Expand my Community achievements bar.

SOLVED

Query Builder Implementation

Avatar

Level 3

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".

1 Accepted Solution

Avatar

Correct answer by
Administrator

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/#.V0QAaPl... (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

View solution in original post

1 Reply

Avatar

Correct answer by
Administrator

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/#.V0QAaPl... (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