I have following AEM query to get such shops which has closing date greater than current date and it works fine.
path=/content/data/shops
type=nt:unstructured
group.p.or=true
group.1_daterange.property=closingDate
group.1_daterange.lowerBound=2024-10-27T00:00:00
But there is possibility that closingDate property might not exist in the backend JCR or closingDate might be empty. I need to get such shops as well. I am using following query but it doesn't work. Kindly help to apply these conditions too.
path=/content/data/shops
type=nt:unstructured
group.p.or=true
group.1_daterange.property=closingDate
group.1_daterange.lowerBound=2024-09-27T00:00:00
group.2_property=closingDate
group.2_property.value=
group.3_property=closingDate
group.3_property.operation=exists
group.3_property.value=false
Thanks in advance.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @touseefk2181136,
First you need to write a query to get all the nodes which has closingDate property.
then iterate through all the results and filter out only with empty date and closing date greater than current date.
another way to create custom predicate https://github.com/arunpatidar02/aemaacs-aemlab/blob/master/core/src/main/java/com/community/aemlab/...
Views
Replies
Total Likes
path=/content/data/shops
type=nt:unstructured
group.1_property=closingDate
group.1_property.value=false
group.1_property.operation=exists
group.2_daterange.property=closingDate
group.2_daterange.lowerBound=2024-10-27T00:00:00
group.p.or=true
For empty condition, please check https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-query-for-property-wit...
Views
Replies
Total Likes
@arunpatidar thanks for sharing. I have three scenarios, it works for two scenarios but not the third one
Views
Replies
Total Likes
Hi @touseefk2181136,
First you need to write a query to get all the nodes which has closingDate property.
then iterate through all the results and filter out only with empty date and closing date greater than current date.
another way to create custom predicate https://github.com/arunpatidar02/aemaacs-aemlab/blob/master/core/src/main/java/com/community/aemlab/...
Views
Replies
Total Likes
@arunpatidar thanks, custom predicate helped to achieve this.
Views
Replies
Total Likes
It might work with xpath query as below :
(
/jcr:root/content/path//*
[
((@test > xs:dateTime('2024-09-27T00:00:00.000Z')))
]
|
/jcr:root/content/path//*
[
(not(@test))
]
|
/jcr:root/content/path//*
[
(@test = '')
]
)
Views
Replies
Total Likes