Back to tool

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

  1. Pick a report type — a ready-made one (Page Finder, Template Usage, Component Usage, …) or ✦ Custom to build your own from scratch.
  2. Give the report a name, then adjust the search path, node type, and any filters.
  3. Read the output tab you need: QueryBuilder, Java, JCR-SQL2, or XPath.
  4. 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 · value rows 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 typecq:Page, dam:Asset, nt:unstructured, nt:base, or a custom type.
  • Template / Resource type — convenience filters; for pages they're matched under jcr:content automatically.
  • 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=value lines) and the ready-to-hit /bin/querybuilder.json?… URL.
  • JavaQueryBuilder API code: builds a PredicateGroup from the same map, runs the query, and iterates the hits.
  • JCR-SQL2 — a SELECT … FROM [type] WHERE … statement (set the limit via QueryManager).
  • XPath — the classic /jcr:root/path//element(*, type)[ … ] form.

Report types (what they pre-fill)

ReportFinds
Page FinderPages under a path, with optional filters
Template UsagePages built on a specific cq:template
Component UsageEverywhere a sling:resourceType is used
Pages by PropertyPages where a jcr:content property matches
Unpublished / StalePages with no replication action
Missing SEO MetadataPages with no meta description
Asset FinderDAM assets by metadata/format/path
Assets Missing MetadataAssets with no dc:title (alt text)
Similar / Duplicate AssetsAssets sharing a title
Property AnywhereAny 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.