aem 6.2 querybuilder api not returning results
Hi
I am using aem 6.2 version. am trying to query JCR in a service to retrieve information at /content/dam using query builder API but search results are returned as zero. Is there anything wrong in this snippet or any pre-requisite to use querybuilder API.
Map<String,String> map = new HashMap<String,String>();
map.put("path", "/content/dam");
map.put("type", "dam:Asset");
Query damQuery = queryBuilder.createQuery(PredicateGroup.create(map), jcrSession);
SearchResult searchItems = damQuery.getResult();
logger.debug("DAM search query : {}", searchItems.getQueryStatement());
logger.debug("search total match : {}", searchItems.getTotalMatches());
Iterator<Node> nodes = searchItems.getNodes();
while(nodes.hasNext()) {
Node node = nodes.next();
logger.debug("node name : {}",node.getName());
}
This is the query generated in logs query=select [jcr:path], [jcr:score], * from [nt:base] as a where isdescendantnode(a, '/content/dam') /* xpath: /jcr:root/content/dam//* */, path=/content/dam//*); . If i try to execute same query via CRX query builder screen, it works. Same is not working via API call.

