Find AEM JCR Nodes with Full Text Search | AEM Community Blog Seeding

Find AEM JCR Nodes with Full Text Search by SourceCode
Abstract
Every AEM developer knows that a JCR node consists of properties and values. Whenever a component is configured or whenever page properties are set, the value is saved in the JCR node as properties and values. There are times when we would like to search all the JCR node properties, to match the value with some kind of string. We can do this with fulltext search in AEM. This action is most useful when trying to find unused components in the code. When performing a fulltext search, please be aware that you will be using Jackrabbit Oak, Apache Lucene. You will search via the Apache Lucene indexes, cached in the JCR. Update and Delete operations in the repository are followed by the Lucene reindexing. In this article, we will cover 2 ways of performing a full-text search, with examples. Every AEM developer knows that a JCR node consists of properties and values. Whenever a component is configured or whenever page properties are set, the value is saved in the JCR node as properties and values. There are times when we would like to search all the JCR node properties, to match the value with some kind of string. We can do this with fulltext search in AEM. This action is most useful when trying to find unused components in the code. When performing a fulltext search, please be aware that you will be using Jackrabbit Oak, Apache Lucene. You will search via the Apache Lucene indexes, cached in the JCR. Update and Delete operations in the repository are followed by the Lucene reindexing. In this article, we will cover 2 ways of performing a full-text search, with examples. Quick Links AEM FullText Search with the Query Builder AEM FullText Search with the JCR_SQL2 1. AEM FullText Search with the Query Builder Example 1: In this example we will find all [nt:base] JCR nodes matching any %pants% Search for: anything under "/content/we-retail" and any.properties with values LIKE "%pants%" and show me more than 10 results. ------------- http://localhost:4502/libs/cq/search/content/querydebug.html path=/content/we-retail fulltext=pants p.limit=-1 Visit localhost: http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=UTF-8&query=path%3D%2Fcontent%2Fwe-retail%0D%0Afulltext%3Dpants%0D%0Ap.limit%3D-1 Example 2: In this example we will find all [cq:Page] JCR nodes matching any %weretail/components/structure/page% Search for: anything under "/content/we-retail" and only "cq:Page" nodes and any.properties with values LIKE "%weretail/components/structure/page%" and show me more than 10 results. ------------- http://localhost:4502/libs/cq/search/content/querydebug.html path=/content/we-retail type=cq:Page fulltext=weretail/components/structure/page p.limit=-1
Read Full Blog
Find AEM JCR Nodes with Full Text Search
Q&A
Please use this thread to ask the related questions.
