Expand my Community achievements bar.

SOLVED

Problem with QueryBuilder and path

Avatar

Level 1

Hi,

I tried to fetch informations from the repository using the QueryBuilder.
I could reproduce my problem with the servlet.

When I enter this URL :
http://localhost:4502/bin/querybuilder.json?path=/content/geometrixx/en/products/triangle&type=cq:Pa...

It returns 2 results : Features and Overview.

But I would like the query to also return Triangle which is a cq:Page.

Can you help me plz ?

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi

When you use path=/content/geometrixx/en/products/triangle, it searches pages under the triangle node. If you want the query to return Triangle, you have to use a different path: http://localhost:4502/bin/querybuilder.json?path=/content/geometrixx/en/products&type=cq:Page.

But of course the query will then return more results.

View solution in original post

5 Replies

Avatar

Level 2

I think the correct way to solve this problem would be adding one more parameter:

path.self=true

So your query would be:

http://localhost:4502/bin/querybuilder.json?path=/content/geometrixx/en/products/triangle&type=cq:Pa...

Avatar

Correct answer by
Employee

Hi

When you use path=/content/geometrixx/en/products/triangle, it searches pages under the triangle node. If you want the query to return Triangle, you have to use a different path: http://localhost:4502/bin/querybuilder.json?path=/content/geometrixx/en/products&type=cq:Page.

But of course the query will then return more results.

Avatar

Level 1

Ok, so you confirm what I though, that's not possible.
Then I'll search for the element below cq:Page, which is cq:PageContent.

http://localhost:4502/bin/querybuilder.json?path=/content/geometrixx/en/products/triangle&type=cq:Pa...

Thank you.

Avatar

Employee

Yes that's the way to go if you really want to do that.

cq:PageContent properties are in jcr:content nodes and there is one below each cq:Page.