AEM Query Builder is a powerful search tool in Adobe Experience Manager (AEM) that allows developers to create complex queries for searching content in the JCR repository. It provides a simple and intuitive interface for constructing queries based on various criteria such as node type, property value, and date range.
Query Builder API
The Query Builder API is the programmatic interface to Query Builder in AEM. It provides a set of Java classes that allow developers to construct and execute queries programmatically. The Query Builder API can be used in servlets, OSGi services, and other Java-based components in AEM.
Query Debugger
The Query Debugger is a tool that allows you to test and refine your queries before integrating them into your code. It provides an interface for building and executing queries, and a visualization of the query results.
Query Builder Interface
The Query Builder interface consists of the following components:
- Query Builder tab: This is where you build your query.
- Preview tab: This displays the results of your query.
- Query Description tab: This displays a summary of your query.
- Debug Info tab: This displays the JCR SQL2 query generated by Query Builder.
Query Building Blocks
The building blocks of a query in AEM Query Builder are predicates, sort orders, and filters.
- Predicates: Predicates define the search criteria for your query. They consist of a property name, an operator, and a value. For example, you might create a predicate that searches for content authored by “John Doe”.
- Sort Orders: Sort orders define the order in which the query results are displayed. You can sort by ascending or descending order of a particular property. For example, you might sort by publish date, with the most recent content displayed first.
- Filters: Filters allow you to further refine your search results based on criteria such as node type, property value, or date range. For example, you might add a filter that only displays content of a certain node type.
Query Building Steps
Here are the steps to build a query in AEM Query Builder:
- Choose the Query Builder tab in the Query Debugger tool.
- Select the scope of your query by choosing the path to the content you want to search.
- Build your query using the Query Builder interface, adding predicates, sort orders, and filters as needed.
- Preview your query results by clicking the Execute Query button.
- Refine your query as needed by modifying the query clauses or adding new ones.
- Use the Debug Info tab to see the generated query in JCR SQL2 format for troubleshooting or advanced queries.
Overall, AEM Query Builder is a powerful and flexible tool that enables developers to quickly and easily search for content in the JCR repository.