Unable to create query with querybuilder | Community
Skip to main content
Magicr
New Participant
May 3, 2022
Solved

Unable to create query with querybuilder

  • May 3, 2022
  • 1 reply
  • 1367 views

Hello,

 

for a project I have following folder structure:

/content/sites/dam/pic/0/111

/content/sites/dam/pic/0/11

content/sites/dam/pic/1/02

/content/sites/dam/pic/2/2222

 

The following x-path query works for me to grab the name of last subfolders with two characters in name: /jcr:root/content/sites/dam/pic/*/*/element(*,sling:OrderedFolder)[jcr:like(fn:name(),'__')]

 

I read lots of page whose explained the syntax and provided examples for query builder. It only accept one level of subnodes, even I set value of p.depth greater than one. My question: What is the conversion from above xpath query into one for querybuilder?

 

Thanks in advance.

 

 

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 DEBAL_DAS

Created similar folder structure in DAM as shown in below screenshot -

Using xpath query , getting below result -

 

Here is the query builder query -

 

path=/content/dam/demo/pic
type=sling:Folder
nodename=??
p.limit=-1

Result -

 

 

Useful information has given here -

  • nodename: This is used to search exact nodenames for the result set. It allows few wildcards like: nodename=text* will search for this and any character after it . nodename=text? will search for all records that starts with text but will not return result that contains only text. (Resolves to NodenamePredicateEvaluator).

Note:- During conversion to Xpath query * is converted to % and ? is converted to _ . For Example ‘metadata%’ (metadata node is considered, will return result for  metadata,metadata1,metadata2 etc) but for ‘metadata_’ (metadata node is ignored, will only return result for metadata1, metadata2). Choose your wildcards very wisely. Hope it clears your doubt.

 

http://www.aemcq5tutorials.com/tutorials/adobe-aem-cq5-tutorials/aem-query-builder/

 

Hope this will help.

1 reply

DEBAL_DAS
DEBAL_DASAccepted solution
New Participant
May 3, 2022

Created similar folder structure in DAM as shown in below screenshot -

Using xpath query , getting below result -

 

Here is the query builder query -

 

path=/content/dam/demo/pic
type=sling:Folder
nodename=??
p.limit=-1

Result -

 

 

Useful information has given here -

  • nodename: This is used to search exact nodenames for the result set. It allows few wildcards like: nodename=text* will search for this and any character after it . nodename=text? will search for all records that starts with text but will not return result that contains only text. (Resolves to NodenamePredicateEvaluator).

Note:- During conversion to Xpath query * is converted to % and ? is converted to _ . For Example ‘metadata%’ (metadata node is considered, will return result for  metadata,metadata1,metadata2 etc) but for ‘metadata_’ (metadata node is ignored, will only return result for metadata1, metadata2). Choose your wildcards very wisely. Hope it clears your doubt.

 

http://www.aemcq5tutorials.com/tutorials/adobe-aem-cq5-tutorials/aem-query-builder/

 

Hope this will help.

Magicr
MagicrAuthor
New Participant
May 3, 2022

Thanks for answer. I tried it and it doesn't work either. I always get following message:

 

The query read or traversed more than 100000 nodes. To avoid affecting other tasks, processing was stopped.

Cannot serve request to /libs/cq/search/content/querydebug.html in /libs/cq/search/components/querydebug/querydebug.jsp

Exception:

java.lang.UnsupportedOperationException: The query read or traversed more than 100000 nodes. To avoid affecting other tasks, processing was stopped.

 It will work if I extend the given path with additional layers until last to next. Is there a difference between "OrderedFolder" and "Folder"?

DEBAL_DAS
New Participant
May 3, 2022

I have created sling:OrderedFolder under /content/dam/we-retail/en/pic as shown in below screenshot -

 

Below query is working perfectly without any issue with sling:OrderedFolder-

 

path=/content/dam/we-retail/en/pic
type=sling:OrderedFolder
nodename=??
p.limit=-1

 

Please share your query and folder structure so that I can review.