Query Builder exclude multiple pages without path.self property | Community
Skip to main content
konstantyn_diachenko
New Participant
May 16, 2025
Solved

Query Builder exclude multiple pages without path.self property

  • May 16, 2025
  • 2 replies
  • 777 views

Hi there,

 

I am trying to convert JCR-SQL2 query to Query Builder, but I see a warning that  "Usage of self property in path predicate has been deprecated. Please avoid its usage.". I have tried several approaches but they didn't return valid results. Probably someone of you had experience with it.

 

JCR-SQL2 query:

SELECT * FROM [cq:Page] as page WHERE (ISDESCENDANTNODE(page,'/content/project1/en/child1') OR ISDESCENDANTNODE(page,'/content/project1/en/child2') ) AND NOT ISDESCENDANTNODE(page, '/content/project1/en/page1') AND NOT ISDESCENDANTNODE(page, '/content/project1/en/page2') AND NOT ISSAMENODE(page, '/content/project1/en/page1') AND NOT ISSAMENODE(page, '/content/project1/en/page2')

 

Query Builder:

type=cq:Page p.limit=-1 group.1_group.p.or=true group.1_group.1_path=/content/project1/en/child1 group.1_group.1_path.self=true group.1_group.2_path=/content/project1/en/child2 group.1_group.2_path.self=true group.2_group.path=/content/project1/en/page1 group.2_group.path.self=true group.2_group.p.not=true group.3_group.path=/content/project1/en/page2 group.3_group.path.self=true group.3_group.p.not=true

 

Error:

16.05.2025 16:42:24.680 *WARN* [[0:0:0:0:0:0:0:1] [1747435344674] GET /libs/cq/search/content/querydebug.html HTTP/1.1] com.day.cq.search.impl.builder.RootEvaluator Usage of self property in path predicate has been deprecated. Please avoid its usage. java.lang.Throwable: at com.day.cq.search.impl.builder.RootEvaluator.checkAndLogSelfProperty(RootEvaluator.java:483) [com.day.cq.cq-search:5.13.36] at com.day.cq.search.impl.builder.RootEvaluator.isPathPredicate(RootEvaluator.java:475) [com.day.cq.cq-search:5.13.36] at com.day.cq.search.impl.builder.RootEvaluator.getAllSubQueryObjects(RootEvaluator.java:399) [com.day.cq.cq-search:5.13.36] at com.day.cq.search.impl.builder.RootEvaluator.getAllSubQueryObjects(RootEvaluator.java:379) [com.day.cq.cq-search:5.13.36] at com.day.cq.search.impl.builder.RootEvaluator.getAllSubQueryObjects(RootEvaluator.java:379) [com.day.cq.cq-search:5.13.36] at com.day.cq.search.impl.builder.RootEvaluator.getXPathExpressionWithUnion(RootEvaluator.java:303) [com.day.cq.cq-search:5.13.36] at com.day.cq.search.impl.builder.RootEvaluator.getXPathExpression(RootEvaluator.java:117) [com.day.cq.cq-search:5.13.36] at com.day.cq.search.impl.builder.QueryImpl.executeXpath(QueryImpl.java:459) [com.day.cq.cq-search:5.13.36] at com.day.cq.search.impl.builder.QueryImpl.execute(QueryImpl.java:537) [com.day.cq.cq-search:5.13.36] at com.day.cq.search.impl.builder.QueryImpl.getResult(QueryImpl.java:115) [com.day.cq.cq-search:5.13.36]

 

Does anyone have experience with avoiding path.self property for Query Builder?

 

Thanks!

 

Best answer by konstantyn_diachenko

Hi @santoshsai , 

 

That query doesn't work. I decided to use JCR-SQL2 query. Seems like there is no alternative with the Query Builder.

 

Thanks,

Kostiantyn Diachenko.

2 replies

SantoshSai
New Participant
May 20, 2025

Hi @konstantyn_diachenko,

I think, Adobe has deprecated the use of path.self=true in Query Builder. This deprecation aligns with Adobe's move toward improving search performance and avoiding ambiguous results in complex predicate evaluations.

Reference: https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/developing/full-stack/search/query-builder-predicates

Specifically, the documentation states:

Important Note: An issue has been identified with self property in the current implementation of query builder and using it in queries may not produce correct search results. Changing the current implementation of self property is also not feasible because it might break the existing applications that rely on it. Due to this functionality, self property is now deprecated; it is advised to avoid using it.

Try this, if you want to include results from two branches (child1, child2), while excluding specific pages (page1, page2) and their children, without using path.self=true.

type=cq:Page
p.limit=-1

# Group 1: Include child1 and child2
group.1_group.p.or=true
group.1_group.1_path=/content/project1/en/child1
group.1_group.2_path=/content/project1/en/child2

# Group 2: Exclude /page1 and its descendants
group.2_group.path=/content/project1/en/page1
group.2_group.p.not=true

# Group 3: Exclude /page2 and its descendants
group.3_group.path=/content/project1/en/page2
group.3_group.p.not=true

# Group 4: Exclude /page1 (explicit ISSAMENODE alternative)
group.4_group.path=/content/project1/en/page1
group.4_group.p.exact=true
group.4_group.p.not=true

# Group 5: Exclude /page2 (explicit ISSAMENODE alternative)
group.5_group.path=/content/project1/en/page2
group.5_group.p.exact=true
group.5_group.p.not=true

Hope this helps!

Santosh Sai
konstantyn_diachenko
konstantyn_diachenkoAuthorAccepted solution
New Participant
June 9, 2025

Hi @santoshsai , 

 

That query doesn't work. I decided to use JCR-SQL2 query. Seems like there is no alternative with the Query Builder.

 

Thanks,

Kostiantyn Diachenko.

Kostiantyn DiachenkoCheck out AEM VLT Intellij plugin
New Participant
May 17, 2025

Can you share the AEM environment details? With latest AEM 6.5.20 , java 8, this issue is not there.

konstantyn_diachenko
New Participant
May 20, 2025

@maheshkpati , AEMaaCS (2024.10.18311.20241017T104455Z-241000), Java 11.

Kostiantyn DiachenkoCheck out AEM VLT Intellij plugin