Search code examples
aemquery-builder

AEM Query Builder: Need to search for specific text on all properties on all pages


I need to do a search for all nodes that contain a specific piece of text. I know I can use the LIKE operation for this, but the issue is how to search for the string when you are not specifying any properties? Basically if any property on any node on any page contains the string, I wwant to return those results?

Can anyone help?

G


Solution

  • You can use this to search for any substring inside any properties under any path using AEM Query Builder. You can use asterisk or * If you do not want a substring and just the full text then remove the "*" and give the search text;

    path=/content
    fulltext=*anyTextToSearch*
    

    OR IN XPATH Query

    /jcr:root/content/path/to/page//*[jcr:contains(., '(*anyTextToSearch*')]
    

    OR IN SQL2

    SELECT * FROM [nt:unstructured] AS node
    WHERE ISDESCENDANTNODE(node, "/search/in/path")
    AND CONTAINS([propertyName], "*anyTextToSearch*")