Hi ,
I need to build query with different type and property
Could some one help me on this
1>I have a property called as pagetitle under type cq:PageContent
2>I have a property called as text under type nt:unstructured which also should match a sling property to avoid too much traversing of nodes
3> I would need a OR opertion for this 2 different type
So wrote the query as below using querydebug.html but it does not give what i require
path=/content/project/us/en/computers/handheld/
orderby=@jcr:score
2_group.1_type=nt:unstructured
2_group.1_property=text
2_group.1_property.1_value=%battery%
2_group.1_property.2_value=%Battery%
2_group.1_property.operation=like
2_group.2_property=sling:resourceType
2_group.2_property.1_value=project/components/apps/text
2_group.2_type=cq:PageContent
2_group.2_property=pageTitle
2_group.2_property.1_value=%battery%
2_group.2_property.2_value=%Battery%
2_group.2_property.operation=like
2_group.p.or=true
Regards,
Srinivas
Solved! Go to Solution.
Views
Replies
Total Likes
try with
path=/content/project/us/en/computers/handheld/ orderby=@jcr:score group.1_group.type=nt:unstructured group.1_group.1_property=text group.1_group.1_property.1_value=battery group.1_group.1_property.2_value=Battery group.1_group.1_property.operation=like group.1_group.2_property=sling:resourceType group.1_group.2_property.value=project/components/apps/text group.2_group.type=cq:PageContent group.2_group.property=pageTitle group.2_group.property.1_value=battery group.2_group.property.2_value=Battery group.2_group.property.operation=like group.p.or=true
Hi @srinivas_chann1 ,
Your query looks fine to me, are you getting any errors, or wrong results, after you execute it in query builder, do check the xpath generated query, that will give you an idea if something is missing from your query or if something is wrong with the syntax for the same.
If you are not able to figure out, please post the generated xpath query too, and what you need exactly which is not showing with the xpath generated query
Please refer this document for query builder syntax and reference:
https://github.com/paulrohrbeck/aem-links/blob/master/querybuilder_cheatsheet.md
Views
Replies
Total Likes
The query that was generated was :-
(
/content/project/us/en/computers/handheld//element(*, nt:unstructured)
|
/content/project/us/en/computers/handheld//*
[
((jcr:like(@pageTitle, '%Battery%')
or jcr:like(@pageTitle, '%battery%')))
])
order by @jcr:score
)
I don't see the cq:PageContent and sling resource property in the query generated .
I have added them like below
2_group.2_property=sling:resourceType
2_group.2_property.1_value=project/components/apps/text
2_group.2_type=cq:PageContent
How to get this generated in query??
Regards,
Srinivas
Views
Replies
Total Likes
try with
path=/content/project/us/en/computers/handheld/ orderby=@jcr:score group.1_group.type=nt:unstructured group.1_group.1_property=text group.1_group.1_property.1_value=battery group.1_group.1_property.2_value=Battery group.1_group.1_property.operation=like group.1_group.2_property=sling:resourceType group.1_group.2_property.value=project/components/apps/text group.2_group.type=cq:PageContent group.2_group.property=pageTitle group.2_group.property.1_value=battery group.2_group.property.2_value=Battery group.2_group.property.operation=like group.p.or=true
Thanks Arun for the inputs.
I see now the query almost what I need, I still have a question as why it does not show up like
//element(*, nt:unstructured) and //element(*, cq:PageContent) instead it just shows handheld//*??
Is this expected, internally it map to just types on the node??
/content/project/us/en/computers/handheld//*
[
((jcr:like(@text, '%Battery%')
or jcr:like(@text, '%battery%'))
and (@sling:resourceType = 'project/components/apps/text'))
]
|
/content/project/us/en/computers/handheld//*
[
((jcr:like(@pageTitle, '%Battery%')
or jcr:like(@pageTitle, '%battery%')))
])
order by @jcr:scor
)
Views
Replies
Total Likes
Hi,
This is expected to filter out with type.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies