We have a query in our project which looks like this: '
select [jcr:path], [jcr:score], * from [cq:Taggable] as a where isdescendantnode(a, '/content/customer/hr_HR') and [cq:tags] in('customer_hr_brandname:NP', '/etc/tags/customer_hr_brandname/NP') union select [jcr:path], [jcr:score], * from [cq:Taggable] as a where isdescendantnode(a, '/content/customer/hr_HR') and [cq:tags] like 'customer_hr_brandname:NP/%' union select [jcr:path], [jcr:score], * from [cq:Taggable] as a where isdescendantnode(a, '/content/customer/hr_HR') and [cq:tags] like '/etc/tags/customer_hr_brandname/NP/%' union select [jcr:path], [jcr:score], * from [cq:Taggable] as a where isdescendantnode(a, '/content/customer/hr_HR') and [cq:tags] in('customer_hr_brandname:SV', '/etc/tags/customer_hr_brandname/SV') union select [jcr:path], [jcr:score], * from [cq:Taggable] as a where isdescendantnode(a, '/content/customer/hr_HR') and [cq:tags] like 'customer_hr_brandname:SV/%' union select [jcr:path], [jcr:score], * from [cq:Taggable] as a where isdescendantnode(a, '/content/customer/hr_HR') and [cq:tags] like '/etc/tags/customer_hr_brandname/SV/%' union select [jcr:path], [jcr:score], * from [cq:Taggable] as a where isdescendantnode(a, '/content/customer/hr_HR') and [cq:tags] in('customer_hr_brandname:VE', '/etc/tags/customer_hr_brandname/VE') union select [jcr:path], [jcr:score], * from [cq:Taggable] as a where isdescendantnode(a, '/content/customer/hr_HR') and [cq:tags] like 'customer_hr_brandname:VE/%' union select [jcr:path], [jcr:score], * from [cq:Taggable] as a where isdescendantnode(a, '/content/customer/hr_HR') and [cq:tags] like '/etc/tags/customer_hr_brandname/VE/%' order by [jcr:score] desc
The problem now is, this search doesn't work with an index, which causes severe performance problems. Can we add an Index to the query or how do we use the index for the property [cq:tags] properly?