Hi Team,
I need a query to get list of pages where one the value should not be equal.
For example:
This is my query:
path=content path here
type=cq:Page
1_property=jcr:content/cq:lastReplicationAction
1_property.value=Activate
2_property=jcr:content/channel
2_property.operation=unequals
2_property.value=channel:search
p.limit=-1
I need list of pages, whose channel value should not equal to "channel:search"
The above query is (jcr:content/@cQ:lastReplicationAction = 'Activate' and jcr:content/@channel != 'channel:search')
Here the channel type is multistring
The result of above query is still giving page results where the value is present.
Please let me know what is wrong, is it failing because channel is a multi String ?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @akhilraj ,
You would need to use JCR-SQL2 for this use case.
select * from [cq:Page] as t WHERE ISDESCENDANTNODE(t,'/content/wknd') AND t.[jcr:content/cq:lastReplicationAction] = 'Activate' AND t.[jcr:content/channel] NOT LIKE 'channel:search'
Content with channel:search not being returned.
Content without channel:search gets returned.
Thanks,
Ram
Hi @akhilraj
Example for not equals to:: https://stackoverflow.com/questions/47799479/aem-query-builder-search-where-property-does-not-exist
Hope it helps!
Thanks,
Kiran Vedantam
Hi @Anish-Sinha @Saravanan_Dharmaraj ,
2_property=jcr:content/channel
2_property.operation=not
2_property.value=channel:search
This condition is checking whether channel property exists or not and ignoring the value.
Even if channel exists with a different value other than channel:search, it is not listing.
XPATH query:
/jcr:root/content/cs//element(*, cq:Page)
[
(jcr:content/@cq:lastReplicationAction = 'Activate' and not(jcr:content/@channel))
]
Hi @akhilraj ,
Try adding not instead of unequal for property 2 operation and it should work:
path=content path here
type=cq:Page
1_property=jcr:content/cq:lastReplicationAction
1_property.value=Activate
2_property=jcr:content/channel
2_property.operation=not
2_property.value=channel:search
p.limit=-1
please try this and see
path=content path here
type=cq:Page
1_property=jcr:content/cq:lastReplicationAction
1_property.value=Activate
2_property=@jcr:content/channel
2_property.operation=not
2_property.value=channel:search
p.limit=-1
Hi @akhilraj ,
I tried this query on my local and it works. please check -
type=cq:PageContent
path=/content/mynewsite/language-masters/en
p.limit=-1
1_property=cq:tags
1_property.value=we-retail:activity/hiking
1_property.operation=like
p.not=true
Hi @akhilraj ,
You would need to use JCR-SQL2 for this use case.
select * from [cq:Page] as t WHERE ISDESCENDANTNODE(t,'/content/wknd') AND t.[jcr:content/cq:lastReplicationAction] = 'Activate' AND t.[jcr:content/channel] NOT LIKE 'channel:search'
Content with channel:search not being returned.
Content without channel:search gets returned.
Thanks,
Ram