querybuilder question: return pages with a component which has a specific custom property value? | Community
Skip to main content
March 22, 2021
Solved

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

  • March 22, 2021
  • 2 replies
  • 3905 views

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.
Best answer by Suraj_Kamdi

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

2 replies

Sanket_Kumbharkhane
Level 4
March 22, 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

Suraj_Kamdi
Community Advisor
Suraj_KamdiCommunity AdvisorAccepted solution
Community Advisor
March 22, 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.

TB3dockAuthor
March 22, 2021

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?