Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions tika-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@
(only on the CI, not on local Windows with Docker, see comment in TIKA-4327 on 14.12.2024)
expecting org.eclipse.jetty.client.util.InputStreamResponseListener which is only available
in Jetty up to 11.0.26
but this class is now in org.eclipse.jetty.client, see also
https://jetty.org/docs/jetty/12/programming-guide/migration/11-to-12.html
but this class is now in org.eclipse.jetty.client, see also
https://jetty.org/docs/jetty/12/programming-guide/migration/11-to-12.html
when updating, see also TODO in PipesBiDirectionalStreamingIntegrationTest
and add jakarta.servlet jakarta.servlet-api 6.0.0 to tika-server-core
-->
Expand Down Expand Up @@ -457,6 +457,11 @@
<nimbus-jose-jwt.version>10.8</nimbus-jose-jwt.version>
<javacpp.version>1.5.12</javacpp.version>
<maven.exec.version>3.6.3</maven.exec.version>
<okhttp.version>4.12.0</okhttp.version>
<!-- kotlin-stdlib-jdk7/jdk8 are Kotlin's own legacy artifact names (shims since Kotlin 1.8);
they are not a JDK target. Pinning here resolves enforcer convergence failures when
OkHttp resolves different patch versions of these shims via different transitive paths. -->
<kotlin.version>1.9.10</kotlin.version>

<!-- needs to exist even if empty due to problems with jacoco-maven-plugin -->
<addmod/>
Expand Down Expand Up @@ -1144,6 +1149,36 @@
<artifactId>nimbus-jose-jwt</artifactId>
<version>${nimbus-jose-jwt.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${okhttp.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>${okhttp.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk7</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-common</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
4 changes: 3 additions & 1 deletion tika-parsers/tika-parsers-extended/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
<modules>
<module>tika-parser-sqlite3-module</module>
<module>tika-parser-scientific-module</module>
<module>tika-parser-jina-reader-module</module>
<module>tika-parser-sqlite3-package</module>
<module>tika-parser-scientific-package</module>
<module>tika-parser-jina-reader-package</module>
<module>tika-parsers-extended-integration-tests</module>
</modules>

Expand Down Expand Up @@ -93,4 +95,4 @@
<scm>
<tag>3.0.0-rc1</tag>
</scm>
</project>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>tika-parsers-extended</artifactId>
<groupId>org.apache.tika</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>tika-parser-jina-reader-module</artifactId>
<name>Apache Tika Jina Reader parser module</name>

<properties>
<commonmark.version>0.24.0</commonmark.version>
</properties>

<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${okhttp.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.commonmark</groupId>
<artifactId>commonmark</artifactId>
<version>${commonmark.version}</version>
</dependency>
<dependency>
<groupId>org.commonmark</groupId>
<artifactId>commonmark-ext-gfm-tables</artifactId>
<version>${commonmark.version}</version>
</dependency>
<dependency>
<groupId>org.commonmark</groupId>
<artifactId>commonmark-ext-gfm-strikethrough</artifactId>
<version>${commonmark.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>

<!-- test -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>${okhttp.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>org.apache.tika.parser.jina.reader</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<inputExcludes>
<inputExclude>src/test/resources/test-documents/**</inputExclude>
</inputExcludes>
</configuration>
</plugin>
</plugins>
</build>

<scm>
<tag>3.0.0-rc1</tag>
</scm>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.tika.parser.jina;

import java.io.Serializable;

import org.apache.tika.exception.TikaConfigException;

/**
* Configuration for {@link JinaReaderParser}.
* <p>
* Sends PDF (base64-encoded) or HTML (raw string) content to the
* <a href="https://jina.ai/reader/">Jina Reader API</a> and receives
* back clean markdown, which is then converted to XHTML.
*/
public class JinaReaderConfig implements Serializable {

private static final long serialVersionUID = 1L;

/** Jina Reader API endpoint. */
private String baseUrl = "https://r.jina.ai/";

/** Bearer token for the Jina Reader API. */
private String apiKey = "";

/** HTTP timeout in seconds. Jina Reader is a remote service; default is generous. */
private int timeoutSeconds = 120;

/**
* Response format requested from Jina Reader.
* Valid values: {@code markdown}, {@code html}, {@code text}, {@code screenshot}.
* Default is {@code markdown} since we convert it to XHTML.
*/
private String returnFormat = "markdown";

// ---- getters / setters ------------------------------------------------

public String getBaseUrl() {
return baseUrl;
}

public void setBaseUrl(String baseUrl) throws TikaConfigException {
this.baseUrl = baseUrl;
}

public String getApiKey() {
return apiKey;
}

public void setApiKey(String apiKey) throws TikaConfigException {
this.apiKey = apiKey;
}

public int getTimeoutSeconds() {
return timeoutSeconds;
}

public void setTimeoutSeconds(int timeoutSeconds) {
this.timeoutSeconds = timeoutSeconds;
}

public String getReturnFormat() {
return returnFormat;
}

public void setReturnFormat(String returnFormat) {
this.returnFormat = returnFormat;
}
}
Loading
Loading