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.