QueryBuilder custom Filter

364 Views Asked by At

Is there a way to filter on a property that you know exists?

Map<String, String> predicates = new HashMap<String, String>();
            predicates.put("path", searchPath);
            predicates.put("type", "cq:Page||dam:Asset");
            predicates.put("orderby", orderBy);

    QueryBuilder qb = resourceResolver.adaptTo(QueryBuilder.class);
    Session session = resourceResolver.adaptTo(Session.class);

    Query query = qb.createQuery(PredicateGroup.create(predicates), session);
    query.setHitsPerPage(0);

I know that the results returned should have the following property: "jcr:pubdate"

Is there a way to specify a range of dates or do I have to manually do that to the returned results?

1

There are 1 best solutions below

0
On BEST ANSWER

You can use a daterange predicate for this. Have a look at its evaluator's documentation.