How to optimize Querybuilder query | Community
Skip to main content
New Participant
September 13, 2023
Solved

How to optimize Querybuilder query

  • September 13, 2023
  • 3 replies
  • 832 views
 

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.
Best answer by Harwinder-singh

@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
September 14, 2023

@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
aanchal-sikka
New Participant
September 14, 2023

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
Harwinder-singh
Harwinder-singhAccepted solution
New Participant
September 13, 2023

@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