# 28-Feb-2026 — page-editor: restore enrichment query for cross-hierarchy content paths [#170](https://github.com/nbarrett/ngx-ramblers/issues/170)

## [build 505](https://github.com/nbarrett/ngx-ramblers/actions/runs/22518639185) — [commit 6001af4](https://github.com/nbarrett/ngx-ramblers/commit/6001af42a5db773c6cb18ca7c79edce69bc03515)

_____

Reverts the single raw-regex query approach which broke image resolution
for index pages whose child content paths reference pages outside the
parent path hierarchy (e.g. test-gallery/ → gallery/...).
- Restore depth-limited regex for the top-level query (direct children)
- Restore enrichment query in `enrichIndexColumnsWithImages` using child
indexes' own content paths (handles cross-hierarchy references)
- Remove `allPrefetchedPages` parameter — enrichment fetches its own pages
- Keep `findFirstImageInPage` fallback for TEXT-row-based image sources

### Performance
- Replace O(N) recursive `resolveIndexContent` calls with single batch DB query
using raw regex, with client-side `filterByMaxPathSegments` filtering
- Remove redundant broad prefetch that fetched all sub-pages unnecessarily
- Eliminate separate enrichment and grandchild queries in
`enrichIndexColumnsWithImages` by passing pre-fetched pages from the
top-level query — reduces page-content API calls from 3 to 1
### Image Resolution
- Fix broken images on deeply nested index pages (e.g. by-year → year →
volume → walk) by using unfiltered pre-fetched pages for image search
across all depth levels
- Add `findFirstImageInPage` fallback in `enrichIndexColumnsWithImages`
for pages that use TEXT rows with column-level `imageSource` instead of
CAROUSEL/ALBUM rows (affects Berkshire Weekend Walkers scrapbook)
- Skip `album-index` rows in `findFirstImageInPage` to avoid picking up
stale/default images from index row column data
### Code Cleanup
- Remove dead code: `resolveIndexContent`, `nextVisitedPaths`, broad
prefetch, `visitedPaths`/`prefetchedPages`/`depth` parameters from
public API
- Simplify `albumIndexToPageContent` signature to just
`(pageContentRow, rowIndex)`
- Add `depthLimitedRegex` helper for STARTS_WITH with maxPathSegments
- Add batched walk lookup in `extractAlbumColumns` for album locations
### Testing
- Add 54 unit tests for IndexService helper methods covering
`depthLimitedRegex`, `findFirstImageInPage`, `findFirstTextInPage`,
`optimiseIndexImageSource`, `summarizeTitles`, `deduplicateByHref`,
`calculateDataCompletenessScore`, `sortColumns`,
`filterOutExcludedPaths`, `filterByMaxPathSegments`, `pageContentFrom`
### Location Extraction
- Handle `album-index` rows in `extractTitleAndDescription` via
`indexMarkdown`
- Skip `album-index` rows in `findFirstImageInPage`

- Use match-type-aware regex in index prefetch query so "Contains" paths no longer force a starts-with pattern
- Update filterByMaxPathSegments to respect the configured match type instead of hardcoding startsWith
- Read carousel image titles and dates from gridViewOptions to match the editor's data model
- Add move-to-exclude and move-to-include buttons on content path match rows