Hi,
Please find XPath Query to find node if tag exists. further, you can get the path and read the properties using ValueMap or node API
(/jcr:root/content/we-retail//element(*, cq:PageContent)
[
(@cq:tags)
] | /jcr:root/content/we-retail//element(*, nt:unstructured)[(@cq:tags)])
order by @jcr:score descending