Hi all,
We are on 6.2 SP1 CPF8.
We have created custom index on oak:index for different sites/markets in our repository. In each index defintion, we have added queryPath ( /content/xyz/us,/content/dam/xyz/us) so that when we search in US site, only the custom index is picked up.
When we do a search only on one type either cq:page or dam:asset type, XPATH query is building properly with the path and our Custom Index definition is picked up and results are coming up fine.
However when we do a search on both cq:Page & dam:Asset at the same time using group predicate, XPATH query is building differently( on content root) and due to this OOTB index definition is picking up and search is happening..
fulltext=life
1_group.p.or=true
1_group.1_group.path=/content/xyz/us
1_group.1_group.type=cq:Page
1_group.2_group.path=/content/dam/xyz/us
1_group.2_group.type=dam:Asset
What we want is to have our custom index picked up for above Query. Could anyone let us know how to achieve this? Thanks.
Thanks.
Views
Replies
Total Likes
Hi,
You can't select which index is going to be used for query, its based on cost of execution.
But If you can switch to native queries then only it is possible
Native Query and Index Selection
Oak query engine supports native queries like
//*[rep:native('lucene', 'name:(Hello OR World)')]
If multiple Lucene based indexes are enabled on the system and you need to make use of specific Lucene index like /oak:index/assetIndex then you can specify the index name via functionName attribute on index definition.
For example for assetIndex definition like
Executing following query would ensure that Lucene index from assetIndex should be used
//*[rep:native('lucene-assetIndex', 'name:(Hello OR World)')]
Thanks
Arun
Views
Replies
Total Likes
Hi Arun,
When we search only for content pages or assets using below syntax, we are able to get the results using our custom index (After adding queryPaths in the index definition we are able to get our custom index).
fulltext=life
path=/content/xyz/us
type=cq:Page
And below is the XPATH query built when we hit with above syntax. ( here search is happening on the below given path with our custom index)
/jcr:root/content/xyz/us//element(*, cq:Page)
[
jcr:contains(., 'life')
]
and for DAM search, below is the XPATH query and results are coming from custom index.
/jcr:root/content/dam/xyz/us//element(*, dam:Asset)
[
jcr:contains(., 'life')
]
However when we do search on both content & DAM using below syntax, search happening is on root and OOTB index is getting called( Cost factor is less as per logs)
fulltext=life
1_group.p.or=true
1_group.1_group.path=/content/xyz/us
1_group.1_group.type=cq:Page
1_group.2_group.path=/content/dam/xyz/us
1_group.2_group.type=dam:Asset
//*
[
jcr:contains(., 'life')
]
When we run the same syntax in 6.4( local setup), XPATH query is build on correct paths and custom index is picking up.
(
/jcr:root/content/xyz/us//element(*, cq:Page)
[
(jcr:contains(., 'life'))
]
|
/jcr:root/content/dam/xyz/us//element(*, dam:Asset)
[
(jcr:contains(., 'life'))
]
)
Somehow XPATH query is different in AEM 6.2 Oak version 1.4.17 when compared with AEM 6.4 Oak version 1.8.
So is there any changes in query engine in constructing XPATH query differently in 6.4 or Is there is something wrong we are doing in AEM 6.2 or any snytax to be changed?
Also in Explain query in 6.2, when I run below XPATH query directly, we are seeing syntax error, but it works in 6.4.
(/jcr:root/content/xyz/us//element(*, cq:Page) [(jcr:contains(., 'life')) ] | /jcr:root/content/dam/xyz/us//element(*, dam:Asset)[(jcr:contains(., 'life')) ]) .
Is above OR or | syntax is not supported in 6.2?
Thanks.
Views
Replies
Total Likes
Hi,
It could be the issue with Oak.
You can check all the bugs and fixes in AEM 6.3 at Adobe Experience Manager Help | Release Notes: AEM 6.3 Oak Cumulative Fix Pack
Views
Replies
Total Likes
Seems like querying with multiple paths is not supported in 6.2 version and it's available only from 6.3 onwards.
Thanks.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Like
Replies
Views
Likes
Replies