A standalone AEM bundle that extracts content from cq:Page nodes — including referenced Content Fragments —
and applies the cq:Searchable mixin with search properties, enabling fulltext and semantic search via
the cqSiteSearch Oak Elasticsearch index.
By default (ORIGINAL mode), search properties are written directly to the original /content nodes.
An alternative MIRROR mode writes them to a shadow tree at /var/indexing/expanded-pages instead.
Either way, a lightweight mirror at /var/indexing/expanded-pages is always maintained for operational tracking
(dirty flags, references to included Content Fragments and pages).
all/pom.xml<repositories>
<repository>
<id>oak-indexing</id>
<url>https://oak-indexing.github.io/maven-repository/</url>
<snapshots><enabled>true</enabled></snapshots>
<releases><enabled>true</enabled></releases>
</repository>
</repositories>
pom.xml<expanded.pages.version>1.7.0</expanded.pages.version>
pom.xml<dependency>
<groupId>com.adobe.aem.indexing</groupId>
<artifactId>expanded-page-index</artifactId>
<version>${expanded.pages.version}</version>
</dependency>
all/pom.xmlIn the <embeddeds> block of filevault-package-maven-plugin:
<embedded>
<groupId>com.adobe.aem.indexing</groupId>
<artifactId>expanded-page-index</artifactId>
<target>/apps/your-packages/application/install</target>
</embedded>
In the <dependencies> block:
<dependency>
<groupId>com.adobe.aem.indexing</groupId>
<artifactId>expanded-page-index</artifactId>
</dependency>
ui.config module
The bundle embeds its own repoinit and service user mapping via Sling-Initial-Content, but in AEM Cloud Service
there is a known ordering risk where the bundle can activate before the JCR Installer feeds those configs to ConfigAdmin.
To guarantee reliable startup, add these two files to your project's ui.config module:
ui.config/.../osgiconfig/config/org.apache.sling.jcr.repoinit.RepositoryInitializer~expanded-page-index.cfg.json
{
"scripts": [
"create path (sling:Folder) /var/indexing/expanded-pages/content\n\ncreate service user expanded-page-index-service with forced path system/cq:services/expanded-page-index\n\nset principal ACL for expanded-page-index-service\n allow jcr:read,jcr:modifyProperties,jcr:nodeTypeManagement on /content\n allow jcr:read on /conf\n allow jcr:all on /var\n allow jcr:read on /oak:index\nend"
]
}
ui.config/.../osgiconfig/config/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended~expanded-page-index.cfg.json
{
"user.mapping": [
"com.adobe.aem.indexing.expand:expanded-page-index=[expanded-page-index-service]"
]
}
The bundle requires two Oak indexes before it activates. These are deployed by Adobe into your AEM Cloud Service environment:
cqPageMirror-1-custom-1 — tracks cq:PageMirror nodes (dirty and failed flags)cqFragmentMirror-1-custom-1 — tracks cq:FragmentMirror nodes (dirty flags)cqSiteSearch Elasticsearch index is required for search queries to work, but is not a condition for the bundle to activate.
includeReferencedPageContent=true to keep indexing them; see Referenced page content.rebuildMirror() (see Management). Otherwise pages keep their previously indexed content until they next change.fragmentReferences is replaced by references, migrated automatically on each page's next extraction. Moves of Content Fragments and folders are now tracked like page moves. No index changes are needed.Searchable.fragmentReferences() is replaced by references(). This only matters if you use the bundle's model package directly.
The bundle and its scheduler are both configured via a single OSGi PID com.adobe.aem.indexing.expand.service.SearchableIndexServiceImpl
("Expanded Page Index Configuration" in the OSGi Configuration Manager):
| Property | Default | Description |
|---|---|---|
cron.expression |
0/30 * * * * ? |
Cron expression controlling how often the scheduler triggers a run |
concurrent |
false |
Allow a new run to start while a previous one is still executing |
searchMode |
ORIGINAL |
Where to write cq:Searchable — ORIGINAL (on /content nodes) or MIRROR (on /var/indexing/ nodes). See Search Modes. |
referencePropertyPattern |
fragmentPath |
Regex (full match) applied to property names on cq:Page subnodes to identify Content Fragment references. Adjust when your components use a non-standard property name (e.g. cfArticleReference, cf.*Reference). |
contentPropertiesPropertyName |
elementNames |
Name of the sibling property that lists which fragment fields to extract (source-driven / WKND style). Set to empty to disable this strategy. |
contentPropertyPattern |
(empty) | Regex (full match) applied to property names inside the fragment's jcr:content/data/master node. All matching properties are extracted as body text (pattern-driven / Telekom style). Leave empty to disable. |
applySearchableToFragments |
false |
When true, applies the cq:Searchable mixin to Content Fragment nodes directly, making CFs searchable alongside pages. See Fragment Indexing. |
extractionStrategy |
RENDER |
How page body text is extracted — RENDER (render the page and extract text from the HTML) or PROPERTY_WALK (walk JCR properties via regex). See Page Extraction Strategy. |
renderTimeoutMs |
5000 |
RENDER mode only. Per-page render timeout (ms); a page exceeding this is treated as a transient failure and retried on the next scheduled run. |
renderBatchSize |
50 |
RENDER mode only. Max dirty pages processed per scheduler tick, since each render is expensive. PROPERTY_WALK processes all dirty pages in a single run. |
includeReferencedPageContent |
false |
RENDER mode only. Whether components included from another page (reference components, Experience Fragments, ...) are indexed as part of the including page. By default they render nothing, so only the page's own content is indexed. See Referenced page content. |
maxRetryAttempts |
5 |
After this many consecutive extraction failures for a page, stop retrying automatically and mark it failed=true (excluded from the dirty queue) rather than let it block other pages forever. Applies to both extraction strategies. |
Two strategies control how a page's body text (and Content Fragment references) are extracted. Only one is active at a time, selected via
extractionStrategy. RENDER is the default and needs no further configuration; PROPERTY_WALK is for
finer-grained control over what gets indexed.
RENDER (default) — renders each page through Sling's own request-processing pipeline (SlingInternalRequest)
and extracts text from the resulting HTML's <main> landmark (falling back to <body>).
Content Fragment references are discovered automatically during the render (no referencePropertyPattern/contentPropertiesPropertyName/contentPropertyPattern
config needed) — a wrapping ResourceResolver records every Content Fragment actually resolved while rendering the page and its nested includes/components.
Use this when components don't expose extractable properties, or when the rendered output (not raw property values) best represents what should be searchable.
Notes on RENDER mode:
/master on a direct render) are skipped rather than rendered.ResourceResolver, so a hung render never blocks or races other pages.extractedVia property records which strategy (PROPERTY_WALK or RENDER) produced each page's content.renderBatchSize and renderTimeoutMs only apply to this mode.
A page may include components owned by another page, e.g. a reference component, or an Experience Fragment component including
<xf>/master/jcr:content/root (Experience Fragments are treated like any other page). During an indexing render, a COMPONENT-scope
Sling filter (ReferencedPageFilter) looks at every included component whose resource lives under another page's jcr:content.
Components of the rendered page that only read other pages through the API (navigation, breadcrumb, teaser, list, ...) are not affected.
includeReferencedPageContent=false (default): those components render nothing, so only the page's own content is indexed, and no page references are recorded.includeReferencedPageContent=true: the included content is indexed as part of the including page and tracked like Content Fragments
(see References). When a referenced page is re-extracted and its content changed (or it is an Experience Fragment,
or was deleted), the pages that include it are marked dirty. Propagating only on an actual content change is what lets pages that include each other
settle instead of re-dirtying each other forever. The change is judged on the referenced page's own indexed text, so an edit to a part of it outside
its <main> doesn't re-extract the pages including that part.Changing this option only affects pages extracted afterwards; run rebuildMirror() (see Management) to apply it to all pages.
PROPERTY_WALK — walks the page's JCR properties and extracts text via the
Content Fragment extraction strategies below
(referencePropertyPattern, contentPropertiesPropertyName, contentPropertyPattern).
Cheap and fast; requires components to expose text-bearing properties that the configured patterns can find. Enable it explicitly:
{
"extractionStrategy": "PROPERTY_WALK"
}
(Used by PROPERTY_WALK mode only — RENDER mode discovers Content Fragment references automatically, see above.)
Two strategies control how text is pulled out of referenced Content Fragments. They run independently and can be used simultaneously.
elementNames) that explicitly lists which fragment fields to include.
Use this when your components already declare which fields they render.
contentPropertyPattern) is matched against all property names inside the fragment's data/master node;
every matching property is extracted. Use this when components do not declare field names, or to extract fields from many different CF models uniformly.
contentPropertyPattern: this same regex is also used by standalone fragment indexing
(applySearchableToFragments) to decide what a CF's own search document contains. Both uses answer the same question
("what is this fragment's searchable substance?") for two different destinations: here, the answer becomes content added to a referencing page;
there, it becomes the fragment's own cq:searchContent. In practice a given deployment picks one of these two cases
(embed content in pages, or index fragments as standalone documents), so one shared pattern is sufficient.
Example config using both strategies together:
{
"searchMode": "ORIGINAL",
"extractionStrategy": "PROPERTY_WALK",
"referencePropertyPattern": "cf.*Reference",
"contentPropertiesPropertyName": "elementNames",
"contentPropertyPattern": "body|text|description"
}
The bundle extracts content from cq:Page nodes (including referenced Content Fragments) and applies the cq:Searchable mixin
with search properties to the target node (original or mirror, depending on mode). A lightweight mirror at /var/indexing/expanded-pages
tracks operational state regardless of mode.
When a Content Fragment (or, with includeReferencedPageContent, another page) whose content a page includes is updated,
the page is automatically re-indexed. Both kinds of reference are tracked the same way:
references property of their mirror node (earlier versions wrote Content Fragments to fragmentReferences; it is migrated on the page's next extraction)referencedBy/var/indexing/expanded-pages/moves.
The next run applies queued moves first: it updates the paths of every mirror in the subtree, rewrites them in references/referencedBy
on the other side, and marks the including pages dirty
This works both through real-time JCR observation and a periodic catch-up scan over all CFs (the safety net for anything the observation listener misses,
e.g. a restart window) — the catch-up scan runs regardless of applySearchableToFragments, so it applies even if you only embed CF content
in pages and never index fragments as standalone documents.
cq:Searchable mixin and search properties are written to the original /content nodes. The Elasticsearch index covers /content directly.
Search query:
SELECT [cq:searchTitle], [cq:searchDescription], [jcr:path]
FROM [cq:Searchable]
WHERE ISDESCENDANTNODE('/content/mysite/us/en')
AND contains(*, 'search terms')
OPTION (INDEX TAG cqSiteSearch)
cq:Searchable mixin and search properties are written to mirror nodes at /var/indexing/expanded-pages. The Elasticsearch index covers /var/indexing/expanded-pages.
Search query:
SELECT [cq:searchTitle], [cq:searchDescription], [path]
FROM [cq:Searchable]
WHERE ISDESCENDANTNODE('/var/indexing/expanded-pages/content/mysite/us/en')
AND contains(*, 'search terms')
OPTION (INDEX TAG cqSiteSearch)
To switch to MIRROR mode, add an OSGi config to your ui.config:
ui.config/.../osgiconfig/config/com.adobe.aem.indexing.expand.service.SearchableIndexServiceImpl.cfg.json
{
"searchMode": "MIRROR"
}
By default only cq:Page nodes receive the cq:Searchable mixin. Set applySearchableToFragments: true to also index
Content Fragments directly, so CF-only searches return fragments as first-class results alongside pages.
Enable via OSGi config:
{
"applySearchableToFragments": true
}
What changes when enabled:
cq:Searchable to CF nodes in addition to propagating dirty flags to referencing pages/content/dam (not only those referenced by a page) always runs, regardless of this flag —
it's what catches a CF edit missed by the observation listener (e.g. a restart window) and propagates it to any referencing page.
This flag only controls whether the scan's discovered CFs also get cq:Searchable applied directly to themselves.
/content/dam node has been deleted are cleaned up on the next runWhere the mixin lands depends on searchMode:
| Mode | CF target |
|---|---|
ORIGINAL (default) | Original CF node at /content/dam/.../my-fragment |
MIRROR | CF mirror node at /var/indexing/expanded-pages/content/dam/.../my-fragment |
Fragment body text is extracted using contentPropertyPattern only — the source-driven (elementNames) strategy requires
a component context and is not available for standalone CFs. Configure a pattern to extract body content:
{
"applySearchableToFragments": true,
"contentPropertyPattern": "body|text|description"
}
Searching pages and fragments (ORIGINAL mode):
SELECT * FROM [cq:Searchable]
WHERE ISDESCENDANTNODE('/content')
AND contains(*, 'search terms')
OPTION (INDEX TAG cqSiteSearch)
Searching pages and fragments (MIRROR mode):
SELECT * FROM [cq:Searchable]
WHERE ISDESCENDANTNODE('/var/indexing/expanded-pages/content')
AND contains(*, 'search terms')
OPTION (INDEX TAG cqSiteSearch)
The options above combine differently depending on what you're trying to achieve. Three common scenarios:
Set applySearchableToFragments: true. Fragment discovery scans all CFs under /content/dam, not just ones referenced
by a page, so un-referenced fragments are covered too. Pick a contentPropertyPattern that matches the fields that make up a fragment's own
searchable content (see the note on this pattern's dual role above).
cq:searchContent — and avoid pulling in generic/shared fragment content"
Set extractionStrategy to PROPERTY_WALK and use contentPropertiesPropertyName (source-driven / WKND style) rather than
contentPropertyPattern. contentPropertiesPropertyName requires each component to explicitly declare the fragment fields it renders —
the most precise option, since it can't accidentally pick up a field just because its name matches a broad regex. contentPropertyPattern is coarser
(any field matching the pattern is pulled in, across every CF model), which is easier to set up but easier to over-match generic/shared fields with.
Avoid RENDER mode for this goal — it extracts whatever text is inside <main> on the rendered page, with no per-field control at all.
Leave applySearchableToFragments at its default (false). Either extraction strategy works, but they differ in setup cost:
RENDER (default) needs no Content Fragment configuration at all — CF references and their rendered text are discovered automatically from the page's actual rendered output.PROPERTY_WALK requires you to configure referencePropertyPattern (to find the CF reference property on your components) and at least one of contentPropertiesPropertyName / contentPropertyPattern (to decide what to pull from the fragment) — with nothing configured, referenced fragment content is silently skipped.So RENDER is the zero-config path for this use case; PROPERTY_WALK gives you more control (see the previous scenario) at the cost of having to configure it correctly for your components and CF models.
Both modes expose the same properties on the cq:Searchable node:
| Property | Description |
|---|---|
cq:searchTitle | Page title |
cq:searchDescription | Page description |
cq:searchContent | Extracted page body (multi-value, HTML stripped) |
In ORIGINAL mode these sit on the /content/... page node. In MIRROR mode they sit on the corresponding /var/indexing/expanded-pages/... mirror node.
The mirror at /var/indexing/expanded-pages is always maintained regardless of mode.
It holds operational state only — no search properties in ORIGINAL mode.
/var/indexing/expanded-pages/
├── state/
│ └── lastRun (timestamp of last successful extraction run)
├── moves/ (moves awaiting the next run: from, to)
└── content/ (mirrors /content)
└── mysite/
└── us/
└── en/
└── page/ (cq:PageMirror)
├── path = "/content/mysite/us/en/page"
├── dirty = false
├── references = ["/content/dam/fragments/...", "/content/other/page"]
├── referencedBy = ["/content/including/page"]
├── extractedVia = "RENDER" | "PROPERTY_WALK"
├── retryCount = 0 (consecutive extraction failures)
└── failed = false (true once retryCount reaches maxRetryAttempts)
The bundle exposes a JMX MBean for operational tasks.
Navigate to: http://localhost:4502/system/console/jmx → com.adobe.aem.indexing.expand → ExpandedPageIndexService
| Operation | Description |
|---|---|
runExtraction() | Process pages changed since the last run |
rebuildMirror() | Delete the mirror and rebuild from scratch |
clearMirror() | Delete the mirror without rebuilding |
listFailedPages() | List the /content paths of pages marked failed=true |
retryFailedPages(pathPrefix) | Re-queue failed pages at or under pathPrefix (resets failed, retryCount, and marks them dirty) |
| Attribute | Description |
|---|---|
LastRunTime | Timestamp of the last successful extraction run, or Never |
MirrorStats | totalPages, totalFragments, and lastRunTime |
MirrorBasePath | /var/indexing/expanded-pages |
FailedPageCount | Number of pages currently marked failed=true |
extractionService unsatisfied
The ExpandedPageIndexScheduler depends on ExpandedPageIndexService.
If the service component is unsatisfied, check it directly in the OSGi console and look for any unsatisfied references there.
The service user mapping was not processed before the bundle activated.
Add the ServiceUserMapperImpl.amended config to your ui.config module as described in
Quickstart step 5.
Cause: Oak indexes not yet deployed.
Check: Browse to /oak:index/cqPageMirror-1-custom-1 in CRXDE. If missing, the indexes have not been deployed yet.
The bundle logs "Oak indexes not yet available" each scheduler cycle until they exist.
Look for "Content extraction service activated" in error.log. If absent, the service user
expanded-page-index-service may not have been created by the bundle's repoinit script.
Check for repoinit errors at startup.
cq:Searchable mixin is present on target nodes (CRXDE — check a /content page in ORIGINAL mode, or a /var/indexing/expanded-pages mirror node in MIRROR mode)elastic-async lane is running — check IndexStats for elastic-async in the JMX consolecqSiteSearch index exists under /oak:index and has type=elasticsearch/content/... for ORIGINAL, /var/indexing/expanded-pages/... for MIRROROPTION (INDEX TAG cqSiteSearch) is present in your querylastRun timestamp at /var/indexing/expanded-pages/state — it should update every 30 secondserror.log for "Previous extraction still running" — a run is taking longer than the scheduler intervalerror.log for "Render timed out after <N>ms" — increase renderTimeoutMs if pages are legitimately slow to render, or investigate why the render is hanging."Render returned status <code>" — a non-200, non-redirect response (e.g. a component throwing) fails the render; fix the underlying rendering error.maxRetryAttempts consecutive failures, the page mirror is marked failed=true and excluded from the dirty queue. Use the FailedPageCount attribute and listFailedPages() JMX operation to find them, and retryFailedPages(pathPrefix) to re-queue them once the cause is fixed.
Moves are picked up through JCR observation. A move made while the bundle isn't listening (e.g. the instance stops mid-move) may not be caught by the
catch-up scan, leaving the mirror at the old path. If that happens after a large move, run rebuildMirror() (see Management).
If you have any issues or questions, please open a ticket.