28-Feb-2026 — page-editor: restore enrichment query for cross-hierarchy content paths #170
build 505 — commit 6001af4
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
enrichIndexColumnsWithImagesusing child indexes' own content paths (handles cross-hierarchy references) - Remove
allPrefetchedPagesparameter — enrichment fetches its own pages - Keep
findFirstImageInPagefallback for TEXT-row-based image sources
Performance
- Replace O(N) recursive
resolveIndexContentcalls with single batch DB query using raw regex, with client-sidefilterByMaxPathSegmentsfiltering - Remove redundant broad prefetch that fetched all sub-pages unnecessarily
- Eliminate separate enrichment and grandchild queries in
enrichIndexColumnsWithImagesby 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
findFirstImageInPagefallback inenrichIndexColumnsWithImagesfor pages that use TEXT rows with column-levelimageSourceinstead of CAROUSEL/ALBUM rows (affects Berkshire Weekend Walkers scrapbook) - Skip
album-indexrows infindFirstImageInPageto avoid picking up stale/default images from index row column data
Code Cleanup
- Remove dead code:
resolveIndexContent,nextVisitedPaths, broad prefetch,visitedPaths/prefetchedPages/depthparameters from public API - Simplify
albumIndexToPageContentsignature to just(pageContentRow, rowIndex) - Add
depthLimitedRegexhelper for STARTS_WITH with maxPathSegments - Add batched walk lookup in
extractAlbumColumnsfor 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-indexrows inextractTitleAndDescriptionviaindexMarkdownSkip
album-indexrows infindFirstImageInPageUse 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