-
Notifications
You must be signed in to change notification settings - Fork 947
TIKA-4766: typed Document parse contract for tika-grpc #2921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
krickert
wants to merge
3
commits into
apache:main
Choose a base branch
from
ai-pipestream:TIKA-4766-document-contract
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,186
−44
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Binary file not shown.
Binary file added
BIN
+26.4 KB
tika-e2e-tests/tika-grpc/src/test/resources/test-fixtures/test_recursive_embedded.docx
Binary file not shown.
4 changes: 4 additions & 0 deletions
4
tika-e2e-tests/tika-grpc/src/test/resources/tika-config-ignite-handlertype.json
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
3 changes: 3 additions & 0 deletions
3
tika-e2e-tests/tika-grpc/src/test/resources/tika-config-ignite-local.json
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Apache Tika gRPC API | ||
|
|
||
| Typed protobuf messages for Tika parse output under `org.apache.tika.grpc.v1`. | ||
|
|
||
| ## Contents | ||
|
|
||
| - **Document** (`document.proto`) — the single, small, stable parse-result contract: a | ||
| structured markdown content tree (`blocks`/`markdown`), typed common metadata | ||
| (`DocumentMetadata`), and a tagged metadata tail (`extra`) for everything | ||
| format-specific. | ||
| - **Bundled descriptors** — `META-INF/org.apache.tika.grpc.v1.descriptors` in the | ||
| published jar. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```xml | ||
| <dependency> | ||
| <groupId>org.apache.tika</groupId> | ||
| <artifactId>tika-grpc-api</artifactId> | ||
| <version>${tika.version}</version> | ||
| </dependency> | ||
| ``` | ||
|
|
||
| ## The Document shape | ||
|
|
||
| Rather than one proto message per source format, `Document` models content and | ||
| metadata by *concern*, not by *format*: | ||
|
|
||
| - **Content** lives in `markdown` (the authoritative render) and `blocks` (the same | ||
| content parsed into a structured tree of headings/paragraphs/lists/tables/code | ||
| blocks/inline runs). This is format-agnostic: every Tika parser's output reaches | ||
| this shape the same way, via markdown. | ||
| - **Metadata** has a small, bounded set of typed common fields on `DocumentMetadata` | ||
| (title, authors, description, keywords, languages, dates, counts, dimensions, | ||
| rights) plus a tagged tail (`extra`, a `repeated MetadataField`) for everything | ||
| format-specific. Tail values are typed where Tika's own `Property` declares a type | ||
| (integer/number/boolean/timestamp), and a string otherwise — never guessed. | ||
| - **`format_category`** is a cheap routing hint (`FormatCategory` enum: PDF, OFFICE, | ||
| IMAGE, HTML, RTF, EPUB, WARC, GENERIC). It is not mutually exclusive with anything | ||
| in `extra` — a document can be `FORMAT_CATEGORY_PDF` and still carry Creative | ||
| Commons rights metadata, for example. | ||
| - **`embedded`** recurses: a PDF with an embedded image is one `Document` whose | ||
| `embedded` list contains a fully-typed child `Document` for the image. | ||
|
|
||
| Format-specific mapping (which Tika `Property` becomes which typed field, and what | ||
| falls through to `extra`) lives in `tika-grpc-mapper`'s | ||
| `org.apache.tika.grpc.mapper.transform.DocumentTransformer` implementations, one per | ||
| format — code, not schema. Adding a parser means adding a transformer; the wire | ||
| contract does not change. | ||
|
|
||
| ## Lint | ||
|
|
||
| ```bash | ||
| cd tika-grpc-api && buf lint | ||
| ``` |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.