Search in sources :

Example 1 with Predicate

use of com.day.cq.search.Predicate in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ListImpl method populateSearchListItems.

private void populateSearchListItems() {
    listItems = new ArrayList<>();
    if (!StringUtils.isBlank(query)) {
        SimpleSearch search = resource.adaptTo(SimpleSearch.class);
        if (search != null) {
            search.setQuery(query);
            search.setSearchIn(startIn);
            search.addPredicate(new Predicate("type", "type").set("type", NameConstants.NT_PAGE));
            search.setHitsPerPage(limit);
            try {
                collectSearchResults(search.getResult());
            } catch (RepositoryException e) {
                LOGGER.error("Unable to retrieve search results for query.", e);
            }
        }
    }
}
Also used : SimpleSearch(com.day.cq.search.SimpleSearch) RepositoryException(javax.jcr.RepositoryException) Predicate(com.day.cq.search.Predicate)

Aggregations

Predicate (com.day.cq.search.Predicate)1 SimpleSearch (com.day.cq.search.SimpleSearch)1 RepositoryException (javax.jcr.RepositoryException)1