Skip to content

fix(rag): index MinerU reference lists and skip page furniture - #2223

Merged
pancacake merged 1 commit into
HKUDS:devfrom
markjoin123:cursor/fix-pdf-ref-list-indexing-29e3
Oct 31, 2026
Merged

pancacake merged 1 commit into
HKUDS:devfrom
markjoin123:cursor/fix-pdf-ref-list-indexing-29e3

Conversation

@markjoin123

Copy link
Copy Markdown
Contributor

Description

MinerU reference lists are content_list blocks with type: list, sub_type: ref_text, and the citations in list_items. PDF indexing only read text, content, table_body, and captions, so those entries never reached the chunker. Page-number, header, and footer blocks were indexed and could become standalone numeric chunks.

build_pdf_documents() now includes list_items and skips those page-furniture blocks. A page whose blocks are only furniture no longer falls back to the PDF text layer, so the printed page number is not indexed after the block is dropped. Margin notes and page footnotes are still indexed. Pages with real blocks and no extracted text still use native page text.

Related Issues

Module(s) Affected

  • services
  • tests

Checklist

  • This PR targets dev (not main — see the base-branch selector above).
  • I have read and followed the contribution guidelines.
  • My code follows the project's coding standards.
  • I have run pre-commit run --all-files and fixed any issues.
  • I have added relevant tests for my changes.
  • I have updated the documentation (if necessary).
  • My changes do not introduce any new security vulnerabilities.

Additional Notes

This change was AI-assisted and was reviewed and tested.

python -m pytest tests/services/rag/test_source_pages.py tests/services/rag/test_mastery_source_pages.py — 92 passed, 1 skipped.

Pre-commit passed on the changed files. A full-tree pre-commit run --all-files still reports existing mypy errors in deeptutor/learning/scheduler.py and deeptutor/services/search/providers/youcom.py, which this change does not touch.

build_pdf_documents() ignored MinerU list_items, so bibliography entries
on type=list / sub_type=ref_text blocks never reached the chunker.
Page-number, header, and footer blocks were indexed instead.

Fixes HKUDS#2222
@pancacake
pancacake merged commit 8e6c40c into HKUDS:dev Oct 31, 2026
23 checks passed
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.

2 participants