Enum Class ParseMode

java.lang.Object
java.lang.Enum<ParseMode>
org.apache.tika.pipes.api.ParseMode
All Implemented Interfaces:
Serializable, Comparable<ParseMode>, Constable

public enum ParseMode extends Enum<ParseMode>
Controls how embedded documents are handled during parsing.

This can be set as a default in PipesConfig (loaded from tika-config.json) or overridden per-file via ParseContext.

  • Enum Constant Details

    • RMETA

      public static final ParseMode RMETA
      Each embedded file gets its own metadata object in a list.

      This is equivalent to the -J option in tika-app and the /rmeta endpoint in tika-server. The result is a list of metadata objects, one for each document (container + all embedded documents).

    • CONCATENATE

      public static final ParseMode CONCATENATE
      Concatenates content from all embedded files into a single document.

      This is equivalent to the legacy tika-app behavior and the /tika endpoint in tika-server. The result is a single metadata object with concatenated content from all documents.

    • NO_PARSE

      public static final ParseMode NO_PARSE
      Performs digest (if configured) and content type detection only.

      No parsing occurs - embedded documents are not extracted and no content is returned. Use this mode when you only need file identification (mime type, hash) without text extraction.

    • CONTENT_ONLY

      public static final ParseMode CONTENT_ONLY
      Concatenates content and emits only the raw content string, with no metadata and no JSON wrapper.

      This mode parses like CONCATENATE (producing a single metadata object with merged content from all embedded documents), but at emit time, emitters write only the value of tk:content as a raw string instead of serializing the full metadata list as JSON.

      This is useful when you want plain text, markdown, or HTML output files without any metadata overhead.

    • UNPACK

      public static final ParseMode UNPACK
      Extracts embedded document bytes and emits them, with full RMETA metadata.

      This mode parses like RMETA (returning a metadata object per document) AND automatically extracts and emits embedded document bytes. An emitter is required for the byte extraction.

      With PASSBACK_ALL emit strategy, embedded bytes are still emitted during parsing, but metadata is passed back to the client instead of being emitted. This is useful when you want bytes written to storage but need metadata returned for further processing (e.g., indexing to a database).

      This mode simplifies byte extraction by handling all the internal setup (UnpackExtractor, EmittingUnpackHandler) automatically. Users just need to specify the emitter in UnpackConfig or FetchEmitTuple.

  • Method Details

    • values

      public static ParseMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ParseMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • parse

      public static ParseMode parse(String modeString)
      Parses a string to a ParseMode enum value.
      Parameters:
      modeString - the string to parse (case-insensitive)
      Returns:
      the corresponding ParseMode
      Throws:
      IllegalArgumentException - if the string doesn't match any mode