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

Avatar

Avatar

TB3dock

Avatar

TB3dock

TB3dock

22-03-2021

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.

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Suraj_Kamdi

MVP

Avatar

Suraj_Kamdi

MVP

Suraj_Kamdi
MVP

22-03-2021

@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.

Answers (1)

Answers (1)

Avatar

Avatar

Sanket_Kumbharkhane

Avatar

Sanket_Kumbharkhane

Sanket_Kumbharkhane

22-03-2021

@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