[Bug]: separate_content() concatenates text blocks before chunking, so page_idx never reaches text chunks

Author: qianheng-awsCreated Aug 11, 2026Updated Sep 15, 2026

Do you need to file an issue?

  • I have searched the existing issues and this bug is not already filed.
  • I believe this is a legitimate bug, not just a question or feature request.

Describe the bug

MinerU records a page_idx on every content block, but separate_content (raganything/utils.py, text_content = "\n\n".join(text_parts)) concatenates all text blocks into one string before LightRAG token-chunks it. The page index does not survive into the resulting chunks.

Measured on a mixed corpus: all 128 multimodal chunks carried a page_idx (each multimodal block becomes exactly one chunk, so it survives), while all 57 plain-text chunks carried none.

Why it matters

Any downstream feature that needs page provenance for text — page-anchored citations, figure-to-chunk association by page range, PDF viewers jumping to the source page — is unbuildable for exactly the chunks that carry the bulk of the document. LightRAG itself has been moving toward positional metadata (HKUDS/LightRAG#3081 emits page-level positions from page_idx in its own MinerU path), but content ingested through RAG-Anything's separate_content loses the information before LightRAG ever sees it.

Expected Behavior

Preserve per-block page_idx through chunking — e.g. chunk per page-run instead of one concatenated string, or carry a block-offset→page map alongside the text so chunks can be annotated after splitting.