querybuilder question: return pages with a component which has a specific custom property value? | Community
Skip to main content
Level 8
Mar 22, 2021 11:10 AM UTC
Solved

querybuilder question: return pages with a component which has a specific custom property value?

Hi, is there a way to return URLS for pages which have a component with a property of a specific value?

 

E.g. if there are say 1000 games, and each has an overview page, and each of these pages has a game overview component which has a game ID and game name property.

 

The client website has a list of recently played game ids, and needs to load some thumbnails which are aspects of the games overview page.

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Suraj_Kamdi
Suraj_KamdiAccepted solution
New Participant
Mar 22, 2021 11:21 AM UTC

@tb3dock 

Use the following query builder query to get desired output 

path=/content/game property=sling:resourceType property.value=sample/components/structure/game-overview group.1_property=gameId group.1_property.value=0 (Optional) group.2_property=gameName group.2_property.value=0 (Otional) group.p.and=true p.limit=-1

 I am considering all the possible scenarios here as per provided description.

6 replies

Suraj_Kamdi
Suraj_KamdiAccepted solution
New Participant
Mar 22, 2021 11:21 AM UTC

@tb3dock 

Use the following query builder query to get desired output 

path=/content/game property=sling:resourceType property.value=sample/components/structure/game-overview group.1_property=gameId group.1_property.value=0 (Optional) group.2_property=gameName group.2_property.value=0 (Otional) group.p.and=true p.limit=-1

 I am considering all the possible scenarios here as per provided description.

Translate
TB3dockAuthor
Level 8
Mar 22, 2021 12:17 PM UTC

This is awesome, thanks. Is it possible to specify the type of the component which has the property using type:xxxx?  if so, how do I find out the value of xxxx?

Translate
Sanket_Kumbharkhane
Level 4
Mar 22, 2021 11:20 AM UTC

@tb3dock Yes, please use the query builder tool "/libs/cq/search/content/querydebug.html" to get the results with the help of the below query 

 

Search for specific property : 

path=/content/my-project

type=nt:unstructured

property=gameid

property.value=gameid-value

p.limit=-1

 

Search for property exist

path=/content/my-project

property=gameid

property.operation=exists

property.value=true

p.limit=-1

 

OR with SQL2 : 

 

All nodes where a property contains some String OR Value

SELECT * FROM [nt:unstructured] AS node

WHERE ISDESCENDANTNODE(node, "/search/in/path")

AND CONTAINS([propertyName], "someString")

 

Thanks,

Sanket

Translate