can we write a query for getting lastmodified date of pages at particular location say /content/abc/xyz | Community
Skip to main content
New Participant
Feb 4, 2020 8:18 PM UTC
Solved

can we write a query for getting lastmodified date of pages at particular location say /content/abc/xyz

its fairly simple to get the pages under a particular location but i want to get those pages last modified date as well via AEM query.Any idea for the same ??

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
sunjot16
sunjot16Accepted solution
Employee
Feb 5, 2020 9:48 PM UTC

Yes, you can do that.

 

You can make changes to the following query, as per your use case:

 

/jcr:root/content//element(*,cq:Page)[(@cq:lastModified >= xs:dateTime('2015-11-03T04:00:00.000-05:00') and @5644378:lastModified <= xs:dateTime('2015-11-03T20:00:00.000-05:00')) or (@jcr:created >= xs:dateTime('2019-01-01T04:00:00.000-05:00')
and @6655266:created <= xs:dateTime('2020-11-03T20:00:00.000-05:00'))]

3 replies

sunjot16
sunjot16Accepted solution
Employee
Feb 5, 2020 9:48 PM UTC

Yes, you can do that.

 

You can make changes to the following query, as per your use case:

 

/jcr:root/content//element(*,cq:Page)[(@cq:lastModified >= xs:dateTime('2015-11-03T04:00:00.000-05:00') and @5644378:lastModified <= xs:dateTime('2015-11-03T20:00:00.000-05:00')) or (@jcr:created >= xs:dateTime('2019-01-01T04:00:00.000-05:00')
and @6655266:created <= xs:dateTime('2020-11-03T20:00:00.000-05:00'))]

Translate
KritiRaAuthor
New Participant
Feb 5, 2020 10:23 PM UTC
this will also give the list of page only based on the checking condition. we actually need last modified of the page from query
Translate
Level 3
Feb 5, 2020 8:22 AM UTC

You can Iterate over search results and then adapt the hits to a page and from there get the last modified date of pages. This you can do in Java as well as using groovy script.

Translate