How to optimize the query to get a matching node name and create a custom index?
Hi,
I am using the below query in one of my workflows to search for a node name(article id) in AEM. This is to locate the folder with a particular article id where an asset needs to be moved. Please find the sample query used below
path=/content/dam/testfolder/test-assets
1_group.1_type = sling:Folder
1_group.2_type= sling:OrderedFolder
1_group.3_type=nt:folder
1_group.p.or=true
nodename=12345678_ea
This query is giving me node traversal errors and hence empty results. I tried creating a custom index for this query as per the below suggestion from oak index generator

Please find the screenshot of my custom index below

After this step, the query is still giving node traversal error and it is not even picking my custom index since the cost of OOB index is better than the custom index.
cost for [/oak:index/ntFolderDamLucene] of type (lucene-property) with plan [lucene:ntFolderDamLucene(/oak:index/ntFolderDamLucene) :ancestors:/content/dam/testfolder/test-assets] is 4303257.00
cost for [/oak:index/testFolderDamLucene] of type (lucene-property) with plan [lucene:testFolderDamLucene(/oak:index/testFolderDamLucene) +:ancestors:/content/dam/testfolder/test-assets +:nodeName:21022781_ea] is 6980484.00
How can I fix this issue? How can I optimize my query used to locate a particular matching node name? If not, how I can i improve the cost of my custom index so that it is picked to search just my specific folder? Appreciate if someone can help here.
