Crx/de query | Community
Skip to main content
Level 2
May 4, 2018 8:44 AM UTC
Solved

Crx/de query

Hello,

is there a way to create a query (SQL, SQL2 or Xpath) in order to show the path and one property of the node in crx/de ?

like

select jcr:title  from nt:base

where jcr:path LIKE '/content/.....'

and show in crx/de 2 columns Path and jcr:title.

Thank you so much.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
May 5, 2018 1:53 PM UTC

You can achieve this by Query debugger Tool as suggested by Scott
http://localhost:4502/libs/cq/search/content/querydebug.html

Query

type=nt:base

path:/content/AEM63App/en

property:jcr:title

property.operation : exists

p.hits=selective

p.nodedepth

p.properties=jcr:path jcr:title

p.limit : 21

you can modify above query based on your search criteria.

when you execute this you will be getting an option to get Json query via JSON QueryBuilder Link, when you hit this link you'll get the results like below:

{

   "success":true,

   "results":21,

   "total":21,

   "more":false,

   "offset":0,

   "hits":[

      {

         "jcr:path":"/content/AEM63App/en/travel/jcr:content",

         "jcr:title":"Travel"

      },

      {

         "jcr:path":"/content/AEM63App/en/community/jcr:content",

         "jcr:title":"Our Community"

      },

...

]

you can parse this Json and use wherever you want.

hope this will help.

Thanks

Arun

Arun Patidar

7 replies

Level 2
May 7, 2018 6:27 AM UTC

Thank you so much

Translate
arunpatidar
arunpatidarAccepted solution
New Participant
May 5, 2018 1:53 PM UTC

You can achieve this by Query debugger Tool as suggested by Scott
http://localhost:4502/libs/cq/search/content/querydebug.html

Query

type=nt:base

path:/content/AEM63App/en

property:jcr:title

property.operation : exists

p.hits=selective

p.nodedepth

p.properties=jcr:path jcr:title

p.limit : 21

you can modify above query based on your search criteria.

when you execute this you will be getting an option to get Json query via JSON QueryBuilder Link, when you hit this link you'll get the results like below:

{

   "success":true,

   "results":21,

   "total":21,

   "more":false,

   "offset":0,

   "hits":[

      {

         "jcr:path":"/content/AEM63App/en/travel/jcr:content",

         "jcr:title":"Travel"

      },

      {

         "jcr:path":"/content/AEM63App/en/community/jcr:content",

         "jcr:title":"Our Community"

      },

...

]

you can parse this Json and use wherever you want.

hope this will help.

Thanks

Arun

Translate
Arun Patidar
smacdonald2008
Level 10
May 4, 2018 12:27 PM UTC

See this blog here -- CQ-OPS - How to Use CQ's Query Debugger Tool

Translate
Level 2
May 4, 2018 12:06 PM UTC

Done, it shows only the path

Translate
shridhar_sahu
Level 3
May 4, 2018 11:22 AM UTC

yes directly from crxde -> tools -> query

write query and then execute

Translate
Level 2
May 4, 2018 9:39 AM UTC

jcr-sql queries and execute direclty in crx/de ?

Translate
shridhar_sahu
Level 3
May 4, 2018 9:00 AM UTC

Hi,

The best practice is to write jcr-sql queries and execute it.

So instead of generating, write jcr-sql query and you can always check the output by clicking on execute instead of generate.

Follow to below link to learn jcr query:

Chapter 10. Querying and Searching using JCR

Thanks,

Shridhar Sahu

Translate