Using the AEM query builder, will search a content which is available in specified directory only. This query will not search the content in sub directories, 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/features
path.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.
find direct children using 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