Expand my Community achievements bar.

SOLVED

AEM Query date range property to query

Avatar

Level 3

I have a query as below:

 

path=/home/project/users
property=customGroup
property.value=Unverified
type=rep:User

 

From this result I need to filter whose

registrationCompletedDate or jcr:createdDate value is greater than 5 days Both these properties are of type Date.

Can you help how I need to modify the query ? Do we have any property to get the dte greater than a particular value?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @pn_2007,

You can make use of predicate named "relativedaterange" to achieve this.

Below is the sample query. (To get all assets that are modified 5 days before)

path=/content/dam/learnings
type=dam:Asset
relativedaterange.property=jcr:content/jcr:lastModified
relativedaterange.lowerBound=-5d  (If no upperBound is specified, it is treated as 0, indicating current time)
p.limit=-1

If any Date property which is in future like say eventDate and to get all events that will happen in next 5 days, then the query will be like

path=/content/dam/learnings
type=dam:Asset
relativedaterange.property=jcr:content/eventDate
relativedaterange.upperBound=5d  (If no lowerBound is specified, it is treated as 0, indicating current time)
p.limit=-1

Other options in detail about this predicate in below link

 

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @pn_2007,

You can make use of predicate named "relativedaterange" to achieve this.

Below is the sample query. (To get all assets that are modified 5 days before)

path=/content/dam/learnings
type=dam:Asset
relativedaterange.property=jcr:content/jcr:lastModified
relativedaterange.lowerBound=-5d  (If no upperBound is specified, it is treated as 0, indicating current time)
p.limit=-1

If any Date property which is in future like say eventDate and to get all events that will happen in next 5 days, then the query will be like

path=/content/dam/learnings
type=dam:Asset
relativedaterange.property=jcr:content/eventDate
relativedaterange.upperBound=5d  (If no lowerBound is specified, it is treated as 0, indicating current time)
p.limit=-1

Other options in detail about this predicate in below link

 

Avatar

Community Advisor

Try something as below

p.limit=-1
p.hits=full
path=/home/project/users
property=customGroup
property.value=Unverified
type=rep:User
group.1_relativedaterange.property=jcr:created
group.1_relativedaterange.upperBound=-5d
group.2_relativedaterange.property=registrationCompletedDate
group.2_relativedaterange.upperBound=-5d
group.p.or=true

Even you can use daterange instead of relativedaterange.

Regards

Albin I

www.albinsblog.com