Skip to main content

CopyTransformer

Copies metadata fields to new fields

Notes

This functionality duplicates the value(s) of one or more document fields (or metadata) into other fields. It is useful for retaining original data while making modifications, or for mapping data to new fields during processing.

Storing values in an existing field

If a document already has a target field with the same name, new values are appended to the existing list by default. Use onSet to manage this default behavior.

The root-level onSet applies to all operations, while fieldMatcher-level onSet overrides the behavior for specific fields.

Parser Handler Compatibility

This functionality can be applied as either a pre-parse or post-parse handler.

Examples

The following example copies the value of a "creator" and "publisher" fields into an "author" field, adding to any existing values in the "author" field.

handler:
class: CopyTransformer
operations:
- toField: author
onSet: APPEND
fieldMatcher:
method: REGEX
pattern: (creator|publisher)

Usage

Full configuration skeleton, with every option and its default
class: CopyTransformer
label: string
onSet: APPEND
operations:
- fieldMatcher: {}
onSet: APPEND
toField: string

Properties

PropertyTypeRequiredDefault
labelstringNo-
onSetenumNo-
operationsCopyOperation[]No-

Property Details

label

An optional, user-supplied label for this step in the importer pipeline. It has no effect on processing — it exists purely to help identify this step, for example in large configurations or in the visual configurator.

onSet

Defines what to do when the target field already has one or more values. When unspecified, new values are appended to existing ones by default.

Allowed Values

  • APPEND
  • PREPEND
  • REPLACE
  • OPTIONAL

operations

Allows defining multiple operations as a list.