Problem/Motivation
When using the Tika extractor, there is no way to pass a custom Tika configuration file. Tika's default configuration includes OCR (via Tesseract), which can be slow, resource-intensive, and unnecessary when documents contain selectable text.
Apache Tika natively supports a --config= command-line flag that accepts a path to an XML configuration file, allowing fine-grained control over parsers, OCR, and other extraction behavior. The module currently does not expose
this capability.
Without this option, there is no way to pass a custom configuration file to Tika through the module. For example, on Pantheon, Tika 3.x defaults to AUTO OCR mode, which can significantly increase PDF processing times when Tesseract is
invoked. A tika-config.xml that disables OCR is already available at /opt/pantheon/tika/tika-config.xml, and Tika supports passing it via the --config flag — but the module does not expose this option, leaving site administrators with no way to use it.
Proposed resolution
Add an optional "Path to Tika configuration file" text field to the Tika extractor settings form at /admin/config/search/search_api_attachments.
When a valid path is provided, the module passes it to Tika via --config=<path>. When left empty, Tika uses its built-in defaults (no change in existing behavior).
User interface changes
A new optional text field "Path to Tika configuration file" is added to the Tika extractor configuration form at /admin/config/search/search_api_attachments, below the existing "Path to Tika .jar file" field. The
field includes a description with an example path and a note about disabling OCR. Leaving it empty preserves existing behavior.
API changes
None. This change only affects the Tika extractor plugin's internal configuration and command construction. No public API is added or modified.
Data model changes
New optional configuration key tika_config_path (type: string, default: empty string) added to:
config/schema/search_api_attachments.schema.yml— undertika_extractor_configurationconfig/install/search_api_attachments.admin_config.yml— undertika_extractor_configuration
Issue fork search_api_attachments-3581834
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
roshnykunjappan commentedComment #3
roshnykunjappan commentedComment #4
roshnykunjappan commentedRe-rolled patch now includes update_8005. This adds the new tika_config_path config key to existing sites when running drush updb. Without it, the key only gets added when an admin saves the extractor settings form.
Comment #5
roshnykunjappan commentedComment #8
izus commentedthanks this is now merged
Comment #10
izus commentedand released https://www.drupal.org/project/search_api_attachments/releases/10.0.8
thanks again for this interesting contribution
Comment #11
roshnykunjappan commentedThank you so much @izus