AEM Query & Report Builder — User Guide
This tool turns a few inputs (path, node type, template, resource type, properties) into a working AEM query — in four formats at once. Everything runs in your browser.
Quick start
- Pick a report type — a ready-made one (Page Finder, Template Usage, Component Usage, …) or ✦ Custom to build your own from scratch.
- Give the report a name, then adjust the search path, node type, and any filters.
- Read the output tab you need: QueryBuilder, Java, JCR-SQL2, or XPath.
- Copy a single format, or grab everything as .zip.
Custom reports
Pick ✦ Custom to compose a report yourself:
- Report name — used for the download file names and the generated Java method (e.g.
runMyReport). - Property filters — add as many
property · condition · valuerows as you need.- Conditions include equals, not equals, contains, exists, and does not exist (the NOT cases).
- Each value has a type (text / boolean / number / date) so the SQL2 and XPath outputs cast it correctly (e.g.
CAST('true' AS BOOLEAN),xs:dateTime(...)). - With two or more rows, switch Match all (AND) or Match any (OR) — reflected across all four outputs.
Inputs
- Search path — the content root to search under (e.g.
/content/wknd). - Node type —
cq:Page,dam:Asset,nt:unstructured,nt:base, or a custom type. - Template / Resource type — convenience filters; for pages they're matched under
jcr:contentautomatically. - Tag, MIME type (assets), Full-text — common filters.
- Property filters — repeatable rows of property · operator · value. Operators: equals, not equals, contains (like), exists, does not exist. With 2+ filters, switch Match all (AND) / Match any (OR).
- Date range — a property (e.g.
jcr:content/cq:lastModified) plus From/To. - Order by, Limit, and Return columns (
p.properties, also used as ACS report columns).
Output formats
- QueryBuilder — the predicate (
key=valuelines) and the ready-to-hit/bin/querybuilder.json?…URL. - Java —
QueryBuilderAPI code: builds aPredicateGroupfrom the same map, runs the query, and iterates the hits. - JCR-SQL2 — a
SELECT … FROM [type] WHERE …statement (set the limit viaQueryManager). - XPath — the classic
/jcr:root/path//element(*, type)[ … ]form.
Report types (what they pre-fill)
| Report | Finds |
|---|---|
| Page Finder | Pages under a path, with optional filters |
| Template Usage | Pages built on a specific cq:template |
| Component Usage | Everywhere a sling:resourceType is used |
| Pages by Property | Pages where a jcr:content property matches |
| Unpublished / Stale | Pages with no replication action |
| Missing SEO Metadata | Pages with no meta description |
| Asset Finder | DAM assets by metadata/format/path |
| Assets Missing Metadata | Assets with no dc:title (alt text) |
| Similar / Duplicate Assets | Assets sharing a title |
| Property Anywhere | Any node where a property exists/matches |
Tips & caveats
- QueryBuilder is the source of truth. The SQL2 and XPath outputs are best-effort equivalents; a few QueryBuilder predicates don't translate 1:1.
- Operation names vary by AEM version (
unequals,exists,not) — adjust if your instance disagrees. - For performance, keep a tight path, set a limit, and make sure the queried properties are indexed (Oak). Test in a lower environment first.