tballison commented on code in PR #4853: URL: https://github.com/apache/solr/pull/4853#discussion_r3937572390
########## solr/solr-ref-guide/modules/indexing-guide/pages/indexing-with-tika.adoc: ########## @@ -540,9 +552,33 @@ So you can use the other URPs without worrying about unexpected field additions. === Parser-Specific Properties -Parser-specific properties for Tika must be configured directly on your Tika Server instance. Consult the https://tika.apache.org/[Apache Tika documentation] for details. +Server-wide parser properties (things that should apply to every request) must be configured directly on your Tika Server instance, via its own JSON configuration file. Consult the https://tika.apache.org/[Apache Tika documentation] for details. + +For a single request, you can instead pass parser-specific options through Solr using the `tikaserver.config` parameter, whose value is a raw JSON object matching Tika Server's per-request configuration format. +For example, to disable OCR for one request: + +[,console] +---- +$ bin/solr post -c gettingstarted example/exampledocs/solr-word.pdf --params 'literal.id=doc1&tikaserver.config={"pdf-parser":{"ocr":{"strategy":"NO_OCR"}}}' +---- + +[IMPORTANT] +==== +`tikaserver.config` requires your Tika Server to be started with `allowPerRequestConfig: true` in its own JSON configuration (under the `server` section). +This is off by default, and Tika Server logs a warning when it is enabled, because it lets any client that can reach `/update/extract` inject arbitrary parser configuration, including options that spawn external processes such as OCR. +Only enable it if you need per-request configuration, and treat access to your Solr instance's extraction endpoint accordingly. + +[source,json] +---- +{ + "server": { + "allowPerRequestConfig": true + } +} +---- +==== -NOTE: In earlier versions of Solr Cell you could supply Tika configuration directly to Solr. This is no longer possible. +`tikaserver.config` is combined with any password resolved from `resource.password` or `passwordsFile` (see <<Indexing Encrypted Documents>>) into a single request to Tika Server, and is only supported for non-recursive extraction (`tikaserver.recursive=false`, the default); Tika Server has no way to accept per-request configuration for recursive extraction while also returning the XHTML content Solr Cell needs. Review Comment: ``` POST /rmeta/config part "file": <document> part "config": {"basic-content-handler-factory":{"type":"XML"}, "pdf-parser":{"ocr":{"strategy":"NO_OCR"}}, "simple-password-provider":{"password":"..."}} ``` should work. This is less than ideal. My gut says that we should go with symmetry between /rmeta/config/xml and /tika/config/xml; but I now remember why we chose this path. I need to chat with the team to figure out whether to fix this for 4.1.0. Apologies for the noise. -- 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]
