Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

querybuilder basic question

Avatar

Avatar
Ignite 10
Level 4
TB3dock
Level 4

Likes

34 likes

Total Posts

203 posts

Correct Reply

4 solutions
Top badges earned
Ignite 10
Boost 25
Give Back 25
Validate 10
Validate 1
View profile

Avatar
Ignite 10
Level 4
TB3dock
Level 4

Likes

34 likes

Total Posts

203 posts

Correct Reply

4 solutions
Top badges earned
Ignite 10
Boost 25
Give Back 25
Validate 10
Validate 1
View profile
TB3dock
Level 4

22-03-2021

Here we have some example queries:

 

https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/querybuilder-api.html

 

This example: 

 

http://localhost:4502/bin/querybuilder.json?type=cq:Page&orderby=@jcr:content/cq:lastModified

 

returns things like this:

 

  1. hits: [{path: "/etc/security/accountmgr", excerpt: "Service Configuration for Account Self-Service",…},…]
    1. 0: {path: "/etc/security/accountmgr", excerpt: "Service Configuration for Account Self-Service",…}
      1. excerpt: "Service Configuration for Account Self-Service"
      2. lastModified: "2009-03-16 15:46:13"
      3. name: "accountmgr"
      4. path: "/etc/security/accountmgr"
      5. title: "Self-Service Configuration"

 

Questions:

  1. None of the results are actually pages from the site?  The site we have locally is the wknd starter site.  How do you return pages from the site hosted in AEM?
  2. type=cq:Page what other types are available?  Is this the type of the items searched, or the type of the items returned?

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
Level 4
bilal_ahmad
Level 4

Likes

66 likes

Total Posts

108 posts

Correct Reply

16 solutions
Top badges earned
Springboard
Validate 10
Validate 1
Ignite 1
Establish
View profile

Avatar
Springboard
Level 4
bilal_ahmad
Level 4

Likes

66 likes

Total Posts

108 posts

Correct Reply

16 solutions
Top badges earned
Springboard
Validate 10
Validate 1
Ignite 1
Establish
View profile
bilal_ahmad
Level 4

22-03-2021

Hey @TB3dock,

The query(xpath) you shared is : //element(*, cq:Page)
order by jcr:content/@cq:lastModified

 

you are actually searching at the root level, i.e /

 

the results it has returned are 7665 in my case. also It has displayed/presented only 10 results to you(rest are there in hits count). Add this - p.limit=-1 and you'll be able to see al the results on the same page:

bilala23933647_0-1616429468791.png

now to your questions:
Q1. None of the results are actually pages from the site?  The site we have locally is the wknd starter site.  How do you return pages from the site hosted in AEM?
A1. Because you are searching at root (/) these are all cq:Page results, but in order to get specific results from your site, you need to specify your specific project path(like path=/content/we-retail). This is the way you return the intended pages from your AEM instance.

 

Q2. type=cq:Page what other types are available?  Is this the type of the items searched, or the type of the items returned?

A2. There are other node types as well. such as dam:Asset, nt:unstructured, etc. please visit this URL: http://localhost:4502/crx/explorer/nodetypes/index.jsp and you'll find all the registered node types you can query on.



I hope that helps 🙂

 

Thanks,

Bilal.

Answers (4)

Answers (4)

Avatar

Avatar
Seeker
MVP
Suraj_Kamdi
MVP

Likes

145 likes

Total Posts

157 posts

Correct Reply

41 solutions
Top badges earned
Seeker
Bedrock
Engage 1
Springboard
Validate 1
View profile

Avatar
Seeker
MVP
Suraj_Kamdi
MVP

Likes

145 likes

Total Posts

157 posts

Correct Reply

41 solutions
Top badges earned
Seeker
Bedrock
Engage 1
Springboard
Validate 1
View profile
Suraj_Kamdi
MVP

22-03-2021

@TB3dock 

Here is the list of all the primary types available in AEM

https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/custom-nodetypes.h... 

 

If you want to return the specific set of pages with the following sample query 

 

path=/content/game
type=cq:page
property=cq:primaryType
property.value=sample/components/structure/game-overview
p.limit=-1

 

Avatar

Avatar
Give Back 50
MVP
Vijayalakshmi_S
MVP

Likes

499 likes

Total Posts

637 posts

Correct Reply

211 solutions
Top badges earned
Give Back 50
Give Back 5
Ignite 10
Ignite 5
Ignite 3
View profile

Avatar
Give Back 50
MVP
Vijayalakshmi_S
MVP

Likes

499 likes

Total Posts

637 posts

Correct Reply

211 solutions
Top badges earned
Give Back 50
Give Back 5
Ignite 10
Ignite 5
Ignite 3
View profile
Vijayalakshmi_S
MVP

22-03-2021

Hi @TB3dock,

Use this http://localhost:4502/bin/querybuilder.json?type=cq:Page&orderby=@jcr:content/cq:lastModified&p.limi..., you will see the entire result set/resources of type cq:Page

By default, 10 results are returned. If you specifiy "p.limit=-1", it will bring in entire matching/applicable results.

Answer to your queries inline in bold.

Questions:

  • None of the results are actually pages from the site?  The site we have locally is the wknd starter site.  How do you return pages from the site hosted in AEM?
    • If you use above query, you will see your site pages available as part of the result set.
  • type=cq:Page what other types are available?  Is this the type of the items searched, or the type of the items returned?
    • Both + It also influences the index used for query execution.
    • For list of types available and other predicates used as part of query, you can refer the links shared by @Bhuwan_B @Arun_Patidar @Suraj_Kamdi 

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,345 likes

Total Posts

3,220 posts

Correct Reply

914 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,345 likes

Total Posts

3,220 posts

Correct Reply

914 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

22-03-2021

Please go through https://hashimkhan.in/aem-adobecq5-code-templates/query-builder/ to learn more about querybuilder and available predicates and possibilities to achieve using the query builder