Skip to content

feat(documents): add docling (docling-serve) parsing backend - #1

Closed
yuisheaven wants to merge 2 commits into
masterfrom
claude/nextcloud-docling-integration-vbg9jt
Closed

yuisheaven wants to merge 2 commits into
masterfrom
claude/nextcloud-docling-integration-vbg9jt

Conversation

@yuisheaven

@yuisheaven yuisheaven commented Jul 2, 2026 •

Copy link
Copy Markdown
Owner

Add docling-serve as an OCR-strong document-parsing backend alongside
unstructured, for photographed/scanned/handwritten text.

  • Images auto-route to a new images-only DoclingProcessor (priority 20).
  • Scanned/no-text-layer PDFs escalate to docling via
    DOCUMENT_OCR_PROVIDER=docling, reusing the classifier's text-layer
    detection so born-digital PDFs stay on the cheap local tiers.
  • nc_webdav_read_file gains a force_processor argument so the caller can
    re-parse a text-layer PDF (tables / partial text) with docling on demand.

One shared docling-serve HTTP client (document_processors/docling_serve.py)
backs both the DoclingProcessor and the OCR-tier _DoclingServeBackend.

Config: ENABLE_DOCLING, DOCLING_API_URL, DOCLING_TIMEOUT, DOCLING_OCR_LANG,
DOCLING_DO_OCR; docling added to the document_ocr_provider enum. New docling
docker-compose profile. See docs/ADR-031.

Repository owner deleted a comment from claude Bot Jul 2, 2026
@yuisheaven
yuisheaven force-pushed the claude/nextcloud-docling-integration-vbg9jt branch from 378ccf0 to 6e4dd00 Compare July 2, 2026 11:26
@claude

claude Bot commented Jul 2, 2026 •

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

claude added 2 commits July 2, 2026 11:45
Add docling-serve as an OCR-strong document-parsing backend alongside
unstructured, for photographed/scanned/handwritten text.

- Images auto-route to a new images-only DoclingProcessor (priority 20).
- Scanned/no-text-layer PDFs escalate to docling via
  DOCUMENT_OCR_PROVIDER=docling, reusing the classifier's text-layer
  detection so born-digital PDFs stay on the cheap local tiers.
- nc_webdav_read_file gains a force_processor argument so the caller can
  re-parse a text-layer PDF (tables / partial text) with docling on demand.

One shared docling-serve HTTP client (document_processors/docling_serve.py)
backs both the DoclingProcessor and the OCR-tier _DoclingServeBackend.

Config: ENABLE_DOCLING, DOCLING_API_URL, DOCLING_TIMEOUT, DOCLING_OCR_LANG,
DOCLING_DO_OCR; docling added to the document_ocr_provider enum. New docling
docker-compose profile. See docs/ADR-031.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- convert_file: raise ProcessorError (not JSONDecodeError/AttributeError) on a
  non-JSON or non-object docling-serve response, honoring the documented contract.
- docling OCR backend always sends do_ocr=true (it IS the OCR tier); DOCLING_DO_OCR
  now tunes only the image processor, so it can't silently no-OCR scanned PDFs.
  Dropped docling_do_ocr from Settings/env-map (kept in _DEFAULTS for the image path).
- Drop the misleading hardcoded docling_status metadata.
- Docs: correct the docling image MIME list (add gif/webp) + clarify DOCLING_DO_OCR scope.
- Tests: cover convert_file non-dict/non-JSON bodies and the progress-callback path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@yuisheaven
yuisheaven force-pushed the claude/nextcloud-docling-integration-vbg9jt branch from 6e4dd00 to e2ddfc7 Compare July 2, 2026 11:50
@yuisheaven yuisheaven closed this Jul 2, 2026
yuisheaven pushed a commit that referenced this pull request Oct 23, 2026
_encode_dav_url split the URL with urlsplit before quoting the path, which
reads a '#' or '?' in a DAV path as a fragment/query delimiter and drops
everything after it. Both call sites are reachable:

  _get_calendar_url("My #1 Calendar")
    -> .../calendars/<uid>/My%20        (wrong collection)

  a REPORT href for evt%231.ics, which caldav hands back decoded as
  evt#1.ics
    -> .../personal/evt                 (truncated event URL)

The second is the dangerous one: str(event.url) is what update_event and
delete_event act on, and what is returned as `href` -- so the truncation
acts on the wrong object, silently.

That is the same spurious-404 failure _encode_dav_path was added to fix in
PR cbcoutinho#891, so delegate to it rather than restating the rule. The docstring
claimed the two were the same rule and they had already diverged. Only the
authority is split off first, so an absolute URL's scheme, host and port
survive.

Also route list_calendars' PROPFIND through the helper. _calendar_home_url
is stored decoded, so that call was relying on the HTTP layer to normalise
a space for us -- the one URL this client still put on the wire unencoded.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RTTQWZeiRyTvLE78ZBatFN
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