Skip to content

Keep blank PDF pages as chunks to preserve page/chunk alignment#432

Merged
Adityav369 merged 1 commit into
mainfrom
fix/preserve-page-chunk-alignment
Jul 23, 2026
Merged

Keep blank PDF pages as chunks to preserve page/chunk alignment#432
Adityav369 merged 1 commit into
mainfrom
fix/preserve-page-chunk-alignment

Conversation

@Adityav369

Copy link
Copy Markdown
Collaborator

Problem

Since #399, pages that render as visually blank are dropped during ColPali PDF/office rendering. That compacts the chunk list, so chunk numbers no longer match source page numbers for any document containing blank pages — anything that maps a chunk back to its page (viewers, citations) points at the wrong page.

Change

  • Render every page: blank pages become normal chunks again, restoring the chunk-N == page-N invariant.
  • A page that fails to render now yields a white placeholder chunk instead of being silently dropped (a dropped page shifts numbering the same way a blank one did).
  • Documents where every page fails to render still raise, and the pdf2image / text-extraction fallbacks are unchanged.
  • Removed the now-unused blank-detection helpers.

Tests

  • Updated rendering tests: all pages kept, placeholders substituted at the right positions, all-pages-failed still raises.
  • Verified end-to-end that a PDF with interleaved blank pages produces one chunk per page, in page order, through both the normal and high-density batched paths.

🤖 Generated with Claude Code

Blank pages were dropped during ColPali rendering (since #399), so chunk
numbers stopped matching source page numbers for any document containing
blank pages, breaking anything that maps a chunk back to its page.

Render every page: blank pages become normal chunks, and a page that
fails to render now yields a white placeholder instead of being dropped.
Documents where every page fails still error out as before.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Adityav369
Adityav369 merged commit 8c51b8d into main Jul 23, 2026
9 checks passed
@Adityav369
Adityav369 deleted the fix/preserve-page-chunk-alignment branch July 23, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant