简体   繁体   English

Cq5中的查询构建器API

[英]Query builder API in Cq5

Hi I am implementing a Java module to fetch the pages which has a particular component. 嗨,我正在实现一个Java模块来获取具有特定组件的页面。 Below is the code snippet which i use, but when running the module am getting an warning Saying that no PredicateEvaluator found for 'sling:resourceType' . 下面是我使用的代码片段,但是在运行模块时收到警告,说没有为'sling:resourceType'找到PredicateEvaluator。 Kindly suggest me the proper way to give resourceType property as query parameter 请给我建议将resourceType属性作为查询参数的正确方法

Map<String, String> predicateMap = new HashMap<String, String>();
predicateMap.put("path","/content/geometrixx-outdoors/en/men");
predicateMap.put("type", "cq:Page");
predicateMap.put("sling:resourceType", "geometrixx-outdoors/components/title");
predicateMap.put("p.limit", "-1");
QueryBuilder queryBuilder = slingScriptHelper.getService(QueryBuilder.class);
com.day.cq.search.Query queryObj = queryBuilder.createQuery(PredicateGroup.create(predicateMap), session);

sling:resourceType is indeed not a valid predicate evaluator. sling:resourceType确实不是有效的谓词评估程序。 You need to put it as a property: 您需要将其作为属性:

predicateMap.put("property", "jcr:content/sling:resourceType");
predicateMap.put("property.value", "geometrixx-outdoors/components/title");

As you alre filtering type=cq:Page you have to also include jcr:content in the path to the property. 在过滤type = cq:Page时,还必须在属性的路径中包括jcr:content。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM