> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Apache Tika Parser

export const schema = {
  "type": "object",
  "title": "Apache Tika (Deprecated) ",
  "description": "Parse Office documents (ppt/docx/pdf), HTML files, images (jpeg/tiff), and more. See \"Supported Formats\" at https://tika.apache.org/ for a full list. This stage is deprecated. Use 'Apache Tika Container Parser' instead. This stage doesn't work with async-parsing.",
  "required": ["type"],
  "properties": {
    "id": {
      "type": "string",
      "title": "Parser ID",
      "default": "aac63171-350a-4afe-bcec-73059bed630d"
    },
    "label": {
      "type": "string",
      "title": "Label",
      "description": "A label for this Parser Stage",
      "maxLength": 255
    },
    "enabled": {
      "type": "boolean",
      "title": "Enable this Parser Stage",
      "default": true
    },
    "mediaTypes": {
      "type": "array",
      "title": "Media Types to match",
      "description": "Documents with a media type on this list will be matched by this parser stage. See inheritMediaTypes / use default media types for more.",
      "items": {
        "type": "string",
        "pattern": "^[^\\/]+\\/[^\\/]+$",
        "format": "rfc2646"
      }
    },
    "inheritMediaTypes": {
      "type": "boolean",
      "title": "Match default media types in this Parser Stage",
      "description": "Each parser stage has a built-in list of media types it handles by default. If this setting is true, that list will be used along with any optional additional types provided in the mediaTypes list. If this setting is false, this stage will only be selected for media types in the mediaTypes list, and the mediaTypes list becomes a mandatory property which must have at least one valid media type.",
      "default": true
    },
    "ignoredMediaTypes": {
      "type": "array",
      "title": "Media Types to ignore",
      "description": "Documents with a media type on this list will be not be processed by this parser stage.",
      "items": {
        "type": "string",
        "pattern": "^[^\\/]+\\/[^\\/]+$",
        "format": "rfc2646"
      }
    },
    "pathPatterns": {
      "type": "array",
      "title": "File names to parse",
      "description": "Specify a file name or pattern that must be matched for this parser stage to run. Forward slashes (\"/\") are used to join names of files inside archives with the archive name.",
      "items": {
        "type": "object",
        "properties": {
          "syntax": {
            "type": "string",
            "title": "Pattern type",
            "description": "glob uses bash shell-style wildcards; regex uses Java (PCRE-style) regex",
            "enum": ["glob", "regex"],
            "default": "glob"
          },
          "pattern": {
            "type": "string",
            "title": "File name or pattern",
            "description": "e.g.: \"z.txt\" or \"*.md\" or \"/a/*/b/f.txt\" for glob; \"z.txt$\" or \".*\\.txt$\" or \"^/a/[^\\/]*/b/f.txt$\" for regex"
          }
        }
      }
    },
    "errorHandling": {
      "type": "string",
      "title": "Error Handling",
      "enum": ["ignore", "log", "fail", "mark"],
      "default": "mark"
    },
    "outputFieldPrefix": {
      "type": "string",
      "title": "Prefix parsed fields with",
      "description": "Fields extracted by this parser will be prefixed with this string. The remainder of the field name will be as detected in the stream",
      "maxLength": 20,
      "pattern": "^$|^[A-Za-z_][A-Za-z0-9_\\-\\.]+$"
    },
    "includeImages": {
      "type": "boolean",
      "title": "Include images",
      "default": false
    },
    "flattenCompound": {
      "type": "boolean",
      "title": "Flatten compound documents",
      "default": false
    },
    "addFailedDocs": {
      "type": "boolean",
      "title": "Add failed documents",
      "default": false
    },
    "addOriginalContent": {
      "type": "boolean",
      "title": "Add original document content (raw bytes)",
      "default": false
    },
    "contentEncoding": {
      "type": "string",
      "title": "Content transport encoding of the content (per RFC1341)",
      "enum": ["binary", "base64"],
      "default": "binary"
    },
    "returnXml": {
      "type": "boolean",
      "title": "Return parsed content as XML",
      "default": false
    },
    "keepOriginalStructure": {
      "type": "boolean",
      "title": "Return original XML and HTML instead of Tika XML output (only applies if 'Return parsed content as XML is true')",
      "default": false
    },
    "extractHtmlLinks": {
      "type": "boolean",
      "title": "Extract XHTML links",
      "description": "Collect links explicitly declared in document structure (e.g. using HTML tags, bookmarks, etc)",
      "default": true
    },
    "extractOtherLinks": {
      "type": "boolean",
      "title": "Extract other links",
      "description": "Use regex-based heuristic extractor to collect likely links from plain text content in all fields.",
      "default": false
    },
    "excludeContentTypes": {
      "type": "array",
      "title": "Content types to exclude",
      "description": "List of content types to exclude from parsing",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "zipBombCompressionRatio": {
      "type": "integer",
      "title": "Maximum input-to-output byte ratio",
      "description": "Maximum number of output bytes fusion will generate per input byte. If you are indexing highly compressed files, you may increase this value to avoid triggering 'Zip Bomb' detection",
      "default": 200
    },
    "zipBombMaxDepth": {
      "type": "integer",
      "title": "Maximum nesting depth",
      "description": "Returns the maximum XML element nesting level. If you are indexing highly nested files, you may increase this value to avoid triggering 'Zip Bomb' detection",
      "default": 200
    },
    "zipBombMaxPackageEntryDepth": {
      "type": "integer",
      "title": "Maximum package entry depth",
      "description": "Sets the maximum package entry nesting level. If you are indexing highly nested files, you may increase this value to avoid triggering 'Zip Bomb' detection",
      "default": 20
    },
    "type": {
      "type": "string",
      "enum": ["tika"],
      "default": "tika"
    }
  },
  "additionalProperties": false,
  "category": "Other",
  "categoryPriority": 1,
  "unsafe": false
};

export const SchemaParamFields = ({schema}) => {
  const sanitize = str => {
    if (typeof str !== "string") return str;
    return str.replace(/^"(.*)"$/s, "$1").replace(/\\/g, "").replace(/"/g, "'");
  };
  const formatDescription = str => {
    const s = sanitize(str);
    return (/[.!?]\)*$/).test(s) ? s : `${s}.`;
  };
  const {description, properties = {}, required: requiredProps = []} = schema;
  const visibleProps = useMemo(() => Object.entries(properties).filter(([, prop]) => !prop.hints?.includes("hidden")), [properties]);
  return <div>
      {description && <p>{formatDescription(description)}</p>}

      {visibleProps.map(([name, prop]) => {
    const isRequired = requiredProps.includes(name);
    const hasDefault = prop.default !== undefined;
    const rawDefault = prop.default;
    const isComplexDefault = hasDefault && (typeof rawDefault === "object" || typeof rawDefault === "string" && (rawDefault.length > 20 || rawDefault.includes('"')));
    const fieldProps = {
      key: name,
      body: prop.title || name,
      type: prop.type,
      ...prop.title && ({
        post: [<><span className="text-stone-400 dark:text-stone-500">API property: </span>{name}</>]
      }),
      ...isRequired && ({
        required: true
      }),
      ...!isComplexDefault && hasDefault ? {
        default: sanitize(String(rawDefault))
      } : {}
    };
    const isObject = prop.type === "object" && prop.properties;
    const isArrayOfObjects = prop.type === "array" && prop.items?.type === "object" && prop.items.properties;
    return <ParamField {...fieldProps}>
            {prop.description && <p>{formatDescription(prop.description)}</p>}

            {isComplexDefault && <div className="flex">
                <p>
                  <strong>Default:</strong>
                </p>
                <pre className="!my-0">
                  <code>
                    {JSON.stringify(rawDefault, null, 2)}
                  </code>
                </pre>
              </div>}

            {isArrayOfObjects && <div className="flex">
              <p>
                <strong>Object attributes:</strong>
              </p>
              <pre className="!my-0">
                <code>
                  {'{\n'}
                  {Object.entries(prop.items.properties).map(([iname, iprop]) => <>
                      {`  ${iname}`}
                      {prop.items?.required?.includes(iname) && <span style={{
      color: 'red'
    }}> required</span>}
                      {`: {\n    display name: ${sanitize(iprop.title || '')}\n    type: ${iprop.type}\n  }\n`}
                    </>)}
                  {'}'}
                </code>
              </pre>
              </div>}

            {isObject && <Expandable title="properties">
                <SchemaParamFields schema={{
      properties: prop.properties,
      required: prop.required
    }} />
              </Expandable>}
          </ParamField>;
  })}
    </div>;
};

[localhost link]: http://localhost:3000/docs/5/fusion/reference/config-ref/parser-stages/apache-tika-parser

[mintlify link]: https://doc.lucidworks.com/docs/5/fusion/reference/config-ref/parser-stages/apache-tika-parser

[old doc.lw link]: https://doc.lucidworks.com/fusion/5.9/371

<Note>
  **Deprecation and removal notice**
  import { LwTemplate } from '/snippets/LwTemplate.jsx';

  <LwTemplate />

  This parser is deprecated as of Fusion 5.8.0 and is expected to be removed in a later version. Use the asynchronous Tika parsing method instead. For more information, see [Asynchronous Tika Parsing](/docs/5/fusion/getting-data-in/indexing/asynchronous-tika-parsing).
</Note>

Apache Tika is a versatile parser that supports many types of unstructured document formats, such as HTML, PDF, Microsoft Office, OpenOffice, RTF, audio, video, images, and more. A complete list of supported formats is available at [Apache Tika](http://tika.apache.org/).

To perform image text extraction when **Include images** is enabled, install [Tesseract](https://github.com/tesseract-ocr/tesseract) in the server hosting Fusion.

This stage is not compatible with asynchronous Tika parsing.

<Tip>
  When entering configuration values in the UI, use *unescaped* characters, such as `\t` for the tab character. When entering configuration values in the API, use *escaped* characters, such as `\\t` for the tab character.
</Tip>

<SchemaParamFields schema={schema} />
