Expand my Community achievements bar.

SOLVED

How to get the nodes from JCR after specified date ?

Avatar

Former Community Member

 Hi,

 

How to get the nodes from JCR after specified date ? Please post me the sample query.

I tried but no luck.

Thanks in advance

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi in the Query Builder Debugger (/libs/cq/search/content/querydebug.html), you could try this query for finding nodes modified after the 8th of May:

daterange.property=cq:lastModified
daterange.lowerBound=2014-05-08T23:59:59

View solution in original post

5 Replies

Avatar

Level 2

Please find sample JCR-SQL2 query embedded in Java below. It's obvious LastModified should be configurable. 

        String sqlStatement = "SELECT * FROM [nt:base] AS s " +

                    " WHERE ISDESCENDANTNODE([/content/geometrixx/en/products]) " +
                    " and [cq:lastModified] >= '2014-04-01T00:00' " +
                    " and [cq:template] = '/apps/geometrixx/templates/contentpage'";

         javax.jcr.query.Query query = queryManager.createQuery(sqlStatement, "JCR-SQL2");

Avatar

Correct answer by
Employee

Hi in the Query Builder Debugger (/libs/cq/search/content/querydebug.html), you could try this query for finding nodes modified after the 8th of May:

daterange.property=cq:lastModified
daterange.lowerBound=2014-05-08T23:59:59

Avatar

Level 2

Could you please tell me how can can I get the nodes modified with from and to Date range?

For example, nodes modified between 2014-08-08T23:59:59 to 2018-01-08T23:59:59

Avatar

Level 10

Below is a sample queries with date range, modify it per your custom requirements

path=/home/users type=rep:User

group.1_daterange.property=jcr:created group.1_daterange.lowerBound=2014-08-18 group.1_daterange.upperBound=2014-08-19

group.2_daterange.property=cq:lastModified group.2_daterange.lowerBound=2014-08-18 group.2_daterange.upperBound=2014-08-19

group.p.or=true

# date ranges:
daterange.property=cq:lastReplicated
daterange.lowerBound=2013-01-01T00:00:00.000+01:00
daterange.lowerOperation=>=

# show pages that have been modified since they were last published
path=/content/geometrixx
property=cq:lastModifiedBy
property.value=reference-adjustment-service
dateComparison.property1=cq:lastModified
dateComparison.property2=cq:lastReplicated
dateComparison.operation=greater

daterange : This predicate is used to search a date property range. (Resolves to DateRangePredicateEvaluator)

daterange.property : Specify the date property which on which query needs to run.

daterange.lowerBound : Fix a lower bound date range eg. 2010-07-25

daterange.lowerOperation : “>” (default) or “>=”

daterange.upperBound: Fix a upper bound date range eg. 2013-07-26

daterange.upperOperation: “<” (default) or “<=”

relativedaterange: It is an extension of daterange which uses relative offsets to server time. It also supports 1s 2m 3h 4d 5w 6M 7y. (Resolves to RelativeDateRangePredicateEvaluator)

relativedaterange.lowerBound : Lower bound offset, default=0

relativedaterange.upperBound : Upper bound Offset .

aem-links/querybuilder_cheatsheet.md at master · paulrohrbeck/aem-links · GitHub