Hi All,
I have a requirement in that I have to search for a page having the jcr property "topicCategory" or "articleTopicCategories"
and the property value should be "financial_adjustments_and_payments" or it can start with "Financial_Adjustments_and_Payments".
and property value can be the upper case or lower case.
articleTopicCategories | String | Postage_By_Phone,Financial_Adjustments_and_Payments,Managing_Postage_Funds,Invoice_and_Statement_Management |
topicCategory | String | financial_adjustments_and_payments |
topicCategory | String[] | cellular_hotspot_device, financial_adjustments_and_payments, changing_account_information |
so I have written this query.
path=/content/pb/us
type=cq:Page
group.1_property=jcr:content/topicCategory
group.1_property.value=%Financial_Adjustments_and_Payments%
group.1_property.operation=equalsIgnoreCase
group.1_property.operation=like
group.2_property=jcr:content/articleTopicCategories
group.2_property.value=%Financial_Adjustments_and_Payments%
group.2_property.operation=like
group.2_property.operation=equalsIgnoreCase
group.p.or=true
p.limit=-1
so If you read the above query, I have applied like and equal ignore case property. but at one time only one operation is working. Either like or either equal ignore case.
Is there any way to fix this query .
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Raushan ,
In AEM Query Builder, you can't directly apply multiple operations (like equalsIgnoreCase and like) on a single property at the same time within the same group. To achieve the desired result, you need to use multiple conditions to cover all the cases.
Here's how you can construct the query to handle your requirement:
You can structure the query to check all combinations using multiple conditions grouped logically. Here's how you can do it:
path=/content/pb/us
type=cq:Page
group.p.or=true
1_group.p.or=true
1_group.1_property=jcr:content/topicCategory
1_group.1_property.value=financial_adjustments_and_payments
1_group.1_property.operation=equalsIgnoreCase
1_group.2_property=jcr:content/topicCategory
1_group.2_property.value=Financial_Adjustments_and_Payments%
1_group.2_property.operation=like
2_group.p.or=true
2_group.1_property=jcr:content/articleTopicCategories
2_group.1_property.value=financial_adjustments_and_payments
2_group.1_property.operation=equalsIgnoreCase
2_group.2_property=jcr:content/articleTopicCategories
2_group.2_property.value=Financial_Adjustments_and_Payments%
2_group.2_property.operation=like
p.limit=-1
Path and Type:
First Group (1_group.p.or=true):
Second Group (2_group.p.or=true):
Combine Groups with OR (group.p.or=true):
Limit:
This query ensures that it covers both properties (topicCategory and articleTopicCategories) and handles both case sensitivity and partial matches.
Hi @Raushan ,
In AEM Query Builder, you can't directly apply multiple operations (like equalsIgnoreCase and like) on a single property at the same time within the same group. To achieve the desired result, you need to use multiple conditions to cover all the cases.
Here's how you can construct the query to handle your requirement:
You can structure the query to check all combinations using multiple conditions grouped logically. Here's how you can do it:
path=/content/pb/us
type=cq:Page
group.p.or=true
1_group.p.or=true
1_group.1_property=jcr:content/topicCategory
1_group.1_property.value=financial_adjustments_and_payments
1_group.1_property.operation=equalsIgnoreCase
1_group.2_property=jcr:content/topicCategory
1_group.2_property.value=Financial_Adjustments_and_Payments%
1_group.2_property.operation=like
2_group.p.or=true
2_group.1_property=jcr:content/articleTopicCategories
2_group.1_property.value=financial_adjustments_and_payments
2_group.1_property.operation=equalsIgnoreCase
2_group.2_property=jcr:content/articleTopicCategories
2_group.2_property.value=Financial_Adjustments_and_Payments%
2_group.2_property.operation=like
p.limit=-1
Path and Type:
First Group (1_group.p.or=true):
Second Group (2_group.p.or=true):
Combine Groups with OR (group.p.or=true):
Limit:
This query ensures that it covers both properties (topicCategory and articleTopicCategories) and handles both case sensitivity and partial matches.
Well, I think you can achieve it using Xpath as well.
Something like
/jcr:root/content/pb/us//*
[
(jcr:like(fn:lower-case(@topicCategory), '%Financial_Adjustments_and_Payments%'))
]
@Raushan Did you find the suggestions from users helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies