query find if component is used in pages in aem code example
Example 1: query for finding which page component is used in aem
/jcr:root/content//*[@sling:resourceType = 'COMPONENT_PATH'] order by @jcr:score
Example 2: query for finding which page component is used in aem
/jcr:root/content//*[jcr:contains(@sling:resourceType, 'COMPONENT_NAME/PATH')] order by @jcr:score