Using the AEM query builder will search a content that is available in a specified directory only. This query will not search the content in subdirectories, or not even child of the child directories.
Open AEM Query Builder Debugger: http://localhost:4502/libs/cq/search/content/querydebug.html. Add the following options to perform the search.
path=/content/dam/we-retail/en/featurespath.flat=truetype=dam:Assetfulltext=cart
Filters definition:
- path=? // On which path this query will perform the search operation.
- path.flat=true // will look the content only in the specified directory.
- fulltext=? //name or keyword which you are searching for.
find direct children using the query builder
Query tree + URLs
ROOT=group: [{fulltext=fulltext: fulltext=cart}{path=path: path=/content/dam/we-retail/en/features, flat=true}{type=type: type=dam:Asset}]
XPath query to find the direct child in a directory
/jcr:root/content/dam/we-retail/en/features/element(*, dam:Asset)[(jcr:contains(., 'cart'))]
JSON response
You can get the JSON response of this query using this URL: (Note: update the domain(localhost:4502) to browse the url for your AEM instance)
Response:
{"success": true,"results": 1,"total": 1,"more": false,"offset": 0,"hits": [{"path": "/content/dam/we-retail/en/features/cart.png","excerpt": "/content/dam/we-retail/en/features/cart.png","name": "cart.png","title": "cart.png","lastModified": "2016-06-06 16:26:05"}]}
No comments:
Post a Comment
If you have any doubts or questions, please let us know.