Context expansion is now automatic and structure-aware. For structured
documents, expands within the section containing the match. For sections
that exceed the budget or are too small, expands item-by-item outward
skipping noise labels. Unstructured documents use budget-based outward
expansion. Results sorted by relevance score.
- Add doc_item_refs and headings assertions to test_expand_context_docling_merges_metadata
- Add page count and markdown content assertions to test_convert_pdf_with_ocr_engine
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Strengthen test_search_returns_search_result with chunk_id, document_id, and
non-empty labels assertions
- Remove test_chunks_include_document_title (subsumed by strengthened test) and
its cassette
- Rename test_chunks_include_document_info to
test_search_chunk_includes_document_provenance; add document_title is None
assertion for untitled documents
- Move test_search_result_get_primary_label from test_context_enhancement.py to
test_search.py; rename, remove unnecessary @pytest.mark.vcr() decorator
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PictureItem.export_to_markdown() defaults to ImageRefMode.EMBEDDED,
which embeds base64 image data. When _extract_item_text() called this
method during context expansion, base64 data would leak into results.
Now explicitly handles PictureItem with ImageRefMode.PLACEHOLDER to
prevent base64 while still including VLM descriptions and captions.