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 — under tika_extractor_configuration
  • config/install/search_api_attachments.admin_config.yml — under tika_extractor_configuration
Command icon 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

roshnykunjappan created an issue. See original summary.

roshnykunjappan’s picture

Issue summary: View changes
roshnykunjappan’s picture

roshnykunjappan’s picture

Re-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.

roshnykunjappan’s picture

Issue summary: View changes

  • roshnykunjappan committed 208ce288 on 10.0.x
    Issue #3581834: Add support for custom Tika configuration file path (--...
izus’s picture

Status: Needs review » Fixed

thanks this is now merged

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

izus’s picture

Status: Fixed » Closed (fixed)

and released https://www.drupal.org/project/search_api_attachments/releases/10.0.8
thanks again for this interesting contribution

roshnykunjappan’s picture

Thank you so much @izus