Repository navigation
feat(autoindex): extract PowerPoint decks (.pptx), one record per slide - #1117
Conversation
Motivation: since xerj-org#1114, autoindex recognizes a .pptx but junks it as an unsupported document. Decks are a common carrier of business content (reviews, plans, figures) and, like PDF/DOCX, are exactly what grep cannot read, which is where the document-folder recipe measured XERJ's largest margin over grep (6/7 vs 0/7 on PDF/DOCX-only answers). What it does (extract/pptx.rs, new): - One record per slide: `title` (deck title = first slide title, else the file stem), `slide` (1-based position in p:sldIdLst — the number PowerPoint shows; part names do not change when slides are reordered), `slide_title` (title/ctrTitle placeholder), `body`; a long slide is sectioned like a PDF page (`section`, locator `slide{n}-s{k}`). Falls back to ppt/slides/slideN.xml in numeric order when the presentation part or its rels are unusable. - Text is read shape by shape from DrawingML: `a:p` paragraphs, `a:br` breaks; tables as one line per row with ` | `-joined cells, so a value keeps its row and column (DOCX tables currently lose this). - Speaker notes, reached through the slide's notesSlide relationship, are appended to the body under "Speaker notes:" so both BM25 and the semantic field see them. - Skipped: dt/ftr/hdr/sldNum/sldImg placeholders and `a:fld` field text — boilerplate repeated on every slide. - Matching is on local names, so strict-OOXML namespaces read the same. - Bounds: 32 MiB per part, 256 MiB decompressed per container, 64 MiB of extracted text, and MAX_RECORDS_PER_FILE. Hitting any of them sets `truncated` (reported, not silent). A deck with no text is junk. Wiring: Family::Pptx (as_str "pptx", is_document), sniffed from ppt/presentation.xml in zip_container_kind; dispatch in extract/mod.rs; SourceAndDocs band in both order.rs band functions; full-read family in estimate::exact_scan_bytes; whole-file size cap in scan_file. "pptx" is removed from unsupported_document_advice. Evidence (rust:latest container, cargo 1.98.1, Linux): - 7 new extract::pptx tests (order vs part names, numeric fallback, titles/tables/notes/placeholder skipping, empty slides and decks, sectioning, decompression budget, OPC target resolution) pass; the updated sniff test asserts ppt/presentation.xml -> Family::Pptx. - cargo test -p xerj-autoindex --lib: 1167 passed, 0 failed, 2 ignored. - cargo clippy -p xerj-autoindex --all-targets -- -D warnings: clean. - A deck written by python-pptx (real PowerPoint template parts, slides reordered in sldIdLst) sniffed as Pptx and extracted 3 records in display order with the table rows and speaker notes intact (temporary probe test, not committed). Not covered: a deck saved by PowerPoint itself; an end-to-end `xerj autoindex` run against a server. Charts, SmartArt and images contribute no text. Written by an AI coding agent (Claude Code, Claude Opus 5.5), run and reviewed by Tom Villani (@thomas-villani).
|
Thanks for this contribution — we'd like to merge it. Before we can, we need a signed Contributor License Agreement from: @thomas-villani It is a one-time thing per contributor, not per pull request. Read CLA.md, then open a small pull request adding your GitHub username to Once it is merged, comment |
… blob Motivation: under durable preparation (`--no-graph`), `sync_executor` extracts a sealed snapshot blob (`prepared/00000000`) and carries the file's own name only in `Sniffed::logical_name`. The PPTX extractor fell back to `path.file_stem()` for a deck with no title placeholder, so such a deck was titled "00000000" — the xerj-org#722 failure class that `extract_as_document_with_name` and the stub name card already guard against. Fix: `pptx::extract` takes the logical name, and dispatch passes `sn.logical_name` (falling back to `path`), as `code.rs` does. Evidence: new test `an_untitled_deck_is_titled_from_the_logical_name_not_the_blob` sniffs a deck stored as `00000000` with logical name `decks/kickoff.pptx` and extracts it through `extract::extract`. With dispatch passing `path` (the old behaviour) it fails with left: "00000000", right: "kickoff"; with the fix it passes. `cargo test -p xerj-autoindex --lib`: 1170 passed, 0 failed (Linux container); clippy -D warnings and fmt clean.
|
Thanks for this contribution — we'd like to merge it. Before we can, we need a signed Contributor License Agreement from: @thomas-villani It is a one-time thing per contributor, not per pull request. Read CLA.md, then open a small pull request adding your GitHub username to Once it is merged, comment |
|
@cla-bot check |
|
Thanks for this contribution — we'd like to merge it. Before we can, we need a signed Contributor License Agreement from: @thomas-villani It is a one-time thing per contributor, not per pull request. Read CLA.md, then open a small pull request adding your GitHub username to Once it is merged, comment |
|
Re-checking the CLA status for every commit author on this pull request… |
Version bump rc.80 -> rc.81 (17 workspace crates in Cargo.lock). CHANGELOG section cites every window PR: xerj-org#1106 xerj-org#1107 xerj-org#1112 xerj-org#1113 xerj-org#1114 xerj-org#1115 xerj-org#1116 xerj-org#1117 xerj-org#1119 xerj-org#1123 xerj-org#1124. ROADMAP rolled: shortlist re-verified live at cut (four open xerj-org#1091 xerj-org#1092 xerj-org#1094 xerj-org#1100; xerj-org#1093 closed by xerj-org#1112 inside the window and moves to the CHANGELOG). Landing stamp sweep RC.80 -> RC.81 in 54 files — footer stamps only; historical prose ('since rc.80', 'rc.80 closed that', PR xerj-org#1082 claims in llms.txt/llms-full.txt and the S3/alerting answers pages) deliberately left at rc.80.
Written by an AI coding agent (Claude Code, Claude Opus 5.5), run by @thomas-villani, who has reviewed this change.
What this changes, and why
Since #1114, autoindex recognizes a
.pptxbut junks it as an unsupported document. Slide decks are a common home for business content: reviews, plans and figures. Like PDF and DOCX, they are files grep cannot read. That is where the document-folder recipe measured XERJ's largest margin over grep: 6/7 vs 0/7 on questions whose answer lives only in a PDF or DOCX.This PR adds
extract/pptx.rsand aFamily::Pptxfor it.Record shape (one record per slide):
titleslidep:sldIdLst, which is the number PowerPoint shows. Slide part names (slide7.xml) do not change when slides are reordered, so they are not used for numbering.slide_titletitle/ctrTitleplaceholder, when present.bodysectionsplit_sections, the same as a PDF page. Locatorslide{n}-s{k}.Extraction details:
a:pparagraph is a line,a:bris a line break, and sh 8000 apes are separated by blank lines, which is wheresplit_sectionscuts.|. A value keeps its row and column; DOCX tables currently lose this.notesSliderelationship. They are appended underSpeaker notes:, so both BM25 and the semantic field see them.dt/ftr/hdr/sldNum/sldImgplaceholders anda:fldfield text. This is boilerplate repeated on every slide, such as "Confidential" footers, dates and slide numbers.presentation.xmlor its rels are missing or unusable, slides come fromppt/slides/slideN.xmlin numeric order.Bounds. Same reasoning as the decompression cap in
docx.rs, with a container-wide budget added because a deck has many parts:MAX_RECORDS_PER_FILEHitting any of these sets
ExtractStats.truncated, so the truncation is reported, not silent. A deck with no text at all (images only) is junk.Wiring:
Family::Pptxhasas_str"pptx"and is inis_document.ppt/presentation.xmlinzip_container_kind.extract/mod.rs.SourceAndDocsband in bothorder::bandandband_from_family_str. The agreement test covers it.estimate::exact_scan_bytes, and has the whole-file size cap inscan_file."pptx"is removed fromunsupported_document_advice.Evidence
All of the following ran in a
rust:latestLinux container (cargo 1.98.1) on this branch, rebased ontomainat7ad52601. The crate's test build does not compile on Windows; see #1114.The 7 new
extract::pptxtests cover:slide10afterslide9)The updated sniff test asserts that
ppt/presentation.xmlsniffs asFamily::Pptx.Real-file check. I wrote a deck with python-pptx, which uses PowerPoint's default template parts (masters, layouts, notes master), and reordered its slides in
sldIdLst. I ran it throughsniff()andpptx::extractwith a temporary test that is not committed:Checks
cargo fmt -p xerj-autoindex -- --check: clean. Only this crate is touched.cargo clippy -p xerj-autoindex --all-targets -- -D warnings: clean on Linux. CI runs it workspace-wide; I ran it on this crate only.cargo build --release -j 32 -p xerj-autoindexfinished (3m 24s, Linux).cargo test -p xerj-autoindex --lib: 1169 passed, 0 failed.landing/llms.txtand the README list the extracted formats and would gain.pptx. Those files follow the one-open-PR rule and the SEO gates, so I left them for a separate docs PR once this lands.Not run:
crates/xerj-autoindex/tests/.xerj autoindexrun against a server.Provenance
title/ctrTitleplaceholder and reach notes through anotesSliderelationship, as the ECMA-376 layout and python-pptx do. A real deck with an emptyslide_titleor missing notes would falsify this.body, rather than a separate field, is the right retrieval trade-off. Notes then share the slide's semantic vector. A separatenotesfield would be lexical-only, becauseDOC_BODY_FIELDSelectsbody/textonly. I have not measured this either way.🤖 Generated with Claude Code