Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to optimize Querybuilder query

Avatar

Level 1
 

I have this query -

 

group.p.or=true
type=cq:Page
p.limit=10
group.1_group.path=/content/path/path1
group.1_group.1_group.p.or=true
group.1_group.1_group.1_property.value=false
group.1_group.1_group.2_property=jcr:content/pageTemplateType
group.1_group.1_group.1_property=jcr:content/pageTemplateType
group.1_group.1_group.2_property.operation=unequals
group.1_group.1_group.1_property.operation=exists
group.1_group.1_group.2_property.value=template
group.1_group.path.self=true

group.2_group.path=/content/path/path-2
group.2_group.1_group.p.or=true
group.2_group.1_group.1_property.value=false
group.2_group.1_group.2_property=jcr:content/pageTemplateType
group.2_group.1_group.1_property=jcr:content/pageTemplateType
group.2_group.1_group.2_property.operation=unequals
group.2_group.1_group.1_property.operation=exists
group.2_group.1_group.2_property.value=template
group.2_group.path.self=true

 

 

 

 

What I am trying to do is that, query multiple paths and return the paths which have the property 'pageTemplateType' value not equal to 'template' or the property pageTemplateType does not exist.

This query works fine but it takes a long time more than 1 second. But if I just remove the self i.e group.2_group.path.self=true or group.1_group.path.self=true then it takes around only 0.02 second. So I do not understand how to optimize it, how to use self efficiently.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@SumantaPa  Avoid using the self property as there has been an issue identified for this property due to which the  query may give you not just inconsistent results  but also cause some performance issues and such it is marked deprecated.

 

Harwindersingh_1-1694640175314.png

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/implementing/develo...

 

 

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

@SumantaPa  Avoid using the self property as there has been an issue identified for this property due to which the  query may give you not just inconsistent results  but also cause some performance issues and such it is marked deprecated.

 

Harwindersingh_1-1694640175314.png

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/implementing/develo...

 

 

Avatar

Community Advisor

Hello @SumantaPa 

 

Please try following query

type=cq:Page
1_group.1_path=/content/wknd/us
1_group.2_path=/content/wknd/ca
1_group.p.or=true

2_group.1_property=jcr:content/cq:template
2_group.1_property.operation=not
2_group.2_property=jcr:content/cq:template
2_group.2_property.value=/conf/wknd/settings/wcm/templates/landing-page-template
2_group.p.or=true

p.limit=-1



 

- The paths are in 1 group

- The or condition of property is one group

-- Not exists

-- Of a specific template

 

Please adapt as per your needs 


Aanchal Sikka

Avatar

Administrator

@SumantaPa Do you find the suggestions from users useful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. 



Kautuk Sahni