com.day.cq.search.Query.setHitsPerPage()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(76)

本文整理了Java中com.day.cq.search.Query.setHitsPerPage方法的一些代码示例,展示了Query.setHitsPerPage的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setHitsPerPage方法的具体详情如下:
包路径:com.day.cq.search.Query
类名称:Query
方法名:setHitsPerPage

Query.setHitsPerPage介绍

暂无

代码示例

代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons

@Override
default void setHitsPerPage(final long hitsPerPage) {
  unwrapQuery().setHitsPerPage(hitsPerPage);
}

代码示例来源:origin: heervisscher/htl-examples

@Override
public Resource getResource(ResourceResolver resourceResolver, String path) {
  log.info("In getResource {}", path);
  String productId = StringUtils.substringBetween(path, "fp/", ".");
  if (StringUtils.isNotBlank(productId)) {
    log.info("Product id {}", productId);
    Map<String, String> map = new HashMap<String, String>();
    // create query description as hash map (simplest way, same as form post)
    map.put("path", "/content/we-retail/us/en/products");
    map.put("type", "cq:Page");
    map.put("nodename", productId);
    Query query = builder.createQuery(PredicateGroup.create(map), resourceResolver.adaptTo(Session.class));
    query.setStart(0);
    query.setHitsPerPage(1);
    SearchResult result = query.getResult();
    log.info("Query {}", result.getQueryStatement());
    Iterator<Resource> it = result.getResources();
    if (it != null && it.hasNext()) {
      CustomResourceWrapper rw = new CustomResourceWrapper(it.next(), path);
      log.info("In getResource, returning {}", rw.getPath());
      return rw;
    }
  }
  return null;
}

代码示例来源:origin: adobe/aem-core-wcm-components

Query query = queryBuilder.createQuery(predicates, resourceResolver.adaptTo(Session.class));
if (resultsSize != 0) {
  query.setHitsPerPage(resultsSize);

相关文章