AEM xpath query with contains for a certain cq page aem6.5 | Community
Skip to main content
srinivas_chann1
Level 7
June 6, 2022
Solved

AEM xpath query with contains for a certain cq page aem6.5

  • June 6, 2022
  • 1 reply
  • 4938 views

Hi ,

 

Could some one provide inputs as how to generate jcr:contains query using xpath , I would need case insensitive search but only limiting to certain node paths 

 

I am getting the below 

/jcr:root/content/project/us/en//Product_Reference_Guide//element(*, cq:Page)
[
((jcr:content/root/container/node1/_text/
@2107369 = '%battery%'))
and (jcr:contains(jcr:content/root/container/node2/_text/
@2107369, '%baTTery%'))
]
order by 
@6655266:score descending

 

I am using the below in querydebug.html

 

path=/content/project/us/en/Product_Reference_Guide

orderby=@jcr:score

orderby.sort=desc

type=cq:Page

group.1_property=jcr:content/root/container/node1/_text/@text

group.1_property.1_value=%battery%

fulltext.relPath=jcr:content/root/container/node2/_text/@text

fulltext=%baTTery%

 

 

I have used fulltext.relPath  which generated the jcr:contains but cannot use it on other path 

when I use group.1_property  it does not again generate jcr:contains

 

How to solve this. Any inputs will be helpful.

 

Regards,

Srinivas

Best answer by DEBAL_DAS

are you looking for something like the below one -

 

path=/content/we-retail/language-masters/en
type=cq:Page
fulltext=experience
fulltext.relPath=jcr:content
1_property=jcr:content/cq:lastReplicationAction
1_property.value=Activate
2_property=jcr:content/clientlibsJsHead
2_property.value=dam.gui.coral.brandportal.configurations
p.limit=-1

 

1 reply

srinivas_chann1
Level 7
June 7, 2022

Hi,

 

Any inputs from any one as how to generate jcr:contains query using xpath for multiple properties and certain search text

 

Regards,

Srinivas

 

 

DEBAL_DAS
DEBAL_DASAccepted solution
New Member
June 7, 2022

are you looking for something like the below one -

 

path=/content/we-retail/language-masters/en
type=cq:Page
fulltext=experience
fulltext.relPath=jcr:content
1_property=jcr:content/cq:lastReplicationAction
1_property.value=Activate
2_property=jcr:content/clientlibsJsHead
2_property.value=dam.gui.coral.brandportal.configurations
p.limit=-1

 

Debal Das, Senior AEM Consultant
srinivas_chann1
Level 7
June 7, 2022

Thanks for input .

 

I need to search from around 6 nodes from cq: page and it must contain jcr:contains for all the search as i would to search the same text under those nodes. 

 

Any inputs as how could this be done

 

/jcr:root/content/apps/us/en/Product_Reference_Guide//element(*, cq:Page)

    [

    (

              (jcr:contains(jcr:content/root/container/node1/_text/@text, '%Battery%'))

    or (jcr:contains(jcr:content/@jcr:title, '%Battery%'))

    or (jcr:contains(jcr:content/root/container/node2/_text/@text, '%Battery%'))

    or (jcr:contains(jcr:content/root/container/node3/_text/@text, '%Battery%'))

   )

    ]

    order by @6655266:score descending

 

Regards,

Srinivas