Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Not able to get the cq:template property value using cq:page type through query builder.

Avatar

Level 2

Here is my sample query and output for your reference.

Does anyone have any ideas or other things I can check for getting template value?

 

Query:

fulltext=Taj
type=cq:Page
path=/content
group.p.or=true
group.1_property=jcr:content/cq:template
group.1_property.value=/conf/test/settings/wcm/templates/country-template
group.2_property=jcr:content/cq:template
group.2_property.value=/conf/test/settings/wcm/templates/hotel-page-template
group.3_property=jcr:content/cq:template
group.3_property.value=/conf/test/settings/wcm/templates/city-template

 

Json Output:

{"path":"/content/test/us/en/Country","excerpt":"<strong>Taj<\/strong>","name":"Country","title":"Country","lastModified":"2021-12-11 17:19:20","created":"2021-12-11 16:14:15"}

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Ashok884 
Could you please let us know your requirement.

The above query will match the template and property in page node only.

/jcr:root/content/myproj//element(*, cq:Page)
[
(jcr:content/@cq:template = '/conf/test/settings/wcm/templates/country-template' or jcr:content/@cq:template = '/conf/test/settings/wcm/templates/hotel-page-template' or jcr:content/@cq:template = '/conf/test/settings/wcm/templates/city-template')
and (jcr:contains(., 'Taj'))
]

 

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @Ashok884 
Could you please let us know your requirement.

The above query will match the template and property in page node only.

/jcr:root/content/myproj//element(*, cq:Page)
[
(jcr:content/@cq:template = '/conf/test/settings/wcm/templates/country-template' or jcr:content/@cq:template = '/conf/test/settings/wcm/templates/hotel-page-template' or jcr:content/@cq:template = '/conf/test/settings/wcm/templates/city-template')
and (jcr:contains(., 'Taj'))
]

 

Avatar

Community Advisor

Hi @Ashok884 ,

 

Results you got is the default properties of query builder servlet. If you want full properties you need to use p.hits=full in  your query.

 

p.hits=full

else if any need any specific properties alone you need to use p.selective specifying the required properties separated by spaces.

 

p.hits=selective
p.properties=cq:template jcr:path

I tried with cq:PageContent type and i am able to get the results.

 

path=/content
type=cq:PageContent
property=cq:template
property.value=/conf/test/settings/wcm/templates/country-template
p.hits=selective
p.properties=cq:template jcr:path

Incase if you need for type cq:Page, you can use like below.

path=/content
type=cq:Page
property=jcr:content/cq:template
property.value=/conf/test/settings/wcm/templates/country-template
p.hits=selective
p.properties=jcr:path jcr:content/cq:template
p.limit=-1