tballison commented on code in PR #4853:
URL: https://github.com/apache/solr/pull/4853#discussion_r3937492909
##########
solr/modules/extraction/src/java/org/apache/solr/handler/extraction/TikaServerExtractionBackend.java:
##########
@@ -173,26 +185,81 @@ public void extractWithSaxHandler(
* request.tikaserverRecursive</code>
*/
InputStream callTikaServer(InputStream inputStream, ExtractionRequest
request) throws Exception {
- String url = baseUrl + (request.tikaServerRecursive ? "/rmeta" : "/tika");
+ ExtractionMetadata md = buildMetadataFromRequest(request);
+ String pwd = resolvePassword(request, md);
+ String configJson = resolveConfigJson(request, pwd);
HttpClient client = acquiredResourcesRef.get().client;
-
- Request req = client.newRequest(url).method("PUT");
Duration effectiveTimeout =
(request.tikaServerTimeoutSeconds != null &&
request.tikaServerTimeoutSeconds > 0)
? Duration.ofSeconds(request.tikaServerTimeoutSeconds)
: defaultTimeout;
- req.timeout(effectiveTimeout.toMillis(), TimeUnit.MILLISECONDS);
- // Also set idle timeout in case of heavy server side work like OCR
- req.idleTimeout(effectiveTimeout.toMillis(), TimeUnit.MILLISECONDS);
-
- // Headers
- String accept = (request.tikaServerRecursive ? "application/json" :
"text/xml");
- req.headers(h -> h.add("Accept", accept));
String contentType = (request.streamType != null) ? request.streamType :
request.contentType;
- if (contentType != null) {
- req.headers(h -> h.add("Content-Type", contentType));
+
+ String url;
+ Request req;
+ if (configJson != null && request.tikaServerRecursive) {
+ throw new SolrException(
+ SolrException.ErrorCode.BAD_REQUEST,
+ "Per-request TikaServer config (password or "
+ + ExtractingParams.TIKASERVER_CONFIG_JSON
+ + ") is not supported together with "
+ + ExtractingParams.TIKASERVER_RECURSIVE
+ + "=true: TikaServer 4.x has no XML-output variant of
/rmeta/config.");
+ }
+ if (configJson != null) {
+ // Tika 4.x dropped its X-Tika-* configuration headers (including
Password) in favor of a
+ // per-request JSON "config" part on a multipart request; the server
must additionally opt
+ // in with allowPerRequestConfig=true. There is no XML content-handler
variant of
Review Comment:
You can get xml on /rmeta like you can on /tika. That's all still there.
I think this is just an out of date comment?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]