Implement two-tier Docling parsing for faster ingestion#388
Open
ArnavAgrawal03 wants to merge 1 commit intomainfrom
Open
Implement two-tier Docling parsing for faster ingestion#388ArnavAgrawal03 wants to merge 1 commit intomainfrom
ArnavAgrawal03 wants to merge 1 commit intomainfrom
Conversation
…tion Replace always-on OCR with a fast-first approach: try text-layer extraction without OCR/table detection first (seconds), then fall back to full OCR only if no text is found (scanned/image PDFs). This restores the performance of the old unstructured parser while maintaining quality for documents that need it. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implement a two-tier document parsing strategy to resolve the significant ingestion slowdown caused by always-on OCR. The parser now tries fast text-layer extraction first (no OCR, no table detection), and only falls back to the full OCR pipeline if no text is found, which is exactly when it's needed (scanned/image PDFs).
Impact
For text-based PDFs (the majority), parsing time drops from minutes back to seconds, matching the old
unstructuredlibrary behavior. Scanned documents still get OCR'd automatically. This should reduce typical ingestion times from 2+ hours back to minutes for batch uploads.Changes
_parse_document_local()now tries fast first, returns immediately if text is found🤖 Generated with Claude Code