How to optimize Querybuilder query | Community
Skip to main content
New Participant
Sep 13, 2023 7:59 PM UTC
Solved

How to optimize Querybuilder query

 

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Harwinder-singh
Harwinder-singhAccepted solution
New Participant
Sep 13, 2023 9:23 PM UTC

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

 

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/implementing/developing/full-stack/search/query-builder-predicates.html?lang=en#path

 

 

3 replies

kautuk_sahni
Employee
Sep 14, 2023 11:06 AM UTC

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

Translate
Kautuk Sahni
aanchal-sikka
New Participant
Sep 14, 2023 5:14 AM UTC

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 

Translate
Aanchal Sikka
Harwinder-singh
Harwinder-singhAccepted solution
New Participant
Sep 13, 2023 9:23 PM UTC

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

 

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/implementing/developing/full-stack/search/query-builder-predicates.html?lang=en#path

 

 

Translate