Files
DeepTutor/tests
NoxsMedia 6bc366e567 fix(rag): filter MinerU page-layout blocks before indexing (#949)
* fix(rag): filter MinerU page-layout blocks before indexing

* fix(rag): preserve MinerU decision audit history

* fix(rag): index unrecognized MinerU blocks instead of failing the ingest

`require_accepted()` ran on the live ingest path and raised on any block type
without a policy entry, so a MinerU release that renames or adds a type broke
LightRAG indexing outright — where before this policy existed the block was
simply indexed. `V2_AUXILIARY_EQUIVALENTS` made that concrete and worse: it
recorded the knowledge that a newer parser emits `page_header`/`page_footer`/
`page_aside_text`, wrote it into the audit ledger, and then hard-failed on
exactly those values, because the map was never applied to anything.

Two changes, same principle — filter only what is positively recognized as
page chrome:

- Apply the v2 map. Newer auxiliary names normalize onto the vocabulary the
  policy is written in, so upgrading MinerU keeps filtering chrome instead of
  reporting every layout block as unrecognized. Parser blocks stay unmutated;
  only the classification key is normalized.
- Unknown types are indexed and counted, never dropped and never fatal. An
  unrecognized type is far more likely to be new content than new chrome, so
  the failure mode of guessing wrong should be an unclassified block in the
  index, not a dead knowledge base. The ledger records the count (and only
  the count — document text must never reach an audit file), the pipeline logs
  a warning naming the types, and the attempt outcome `unknown_types` says
  the policy needs extending.

---------

Co-authored-by: nox <work@noxsmedia.com>
Co-authored-by: Frank <bingxizhao@novix.science>
2026-08-24 16:35:00 +08:00
..
2026-08-19 17:34:52 +08:00