Skip to main content

ForceSingleValueTransformer

Forces a metadata field to be single-value

Notesโ€‹

The action can be one of the following:

  • keepFirst: Keeps the first occurrence found.
  • keepLast: Keeps the last occurrence found.
  • mergeWith:<sep>: Merges all values into one, separated by <sep>..

If you do not specify any action, the default behavior is to merge all occurrences, joining values with a comma.

Can be used both as a pre-parse or post-parse handler.

Examplesโ€‹

For documents where multiple title fields are found, The following example only keeps the first title value captured.

handler:
class: ExternalParser
action: keepFirst
fieldMatcher:
pattern: title

Usageโ€‹

Full configuration skeleton, with every option and its default
class: ForceSingleValueTransformer
action: string
fieldMatcher:
ignoreCase: false
ignoreDiacritic: false
matchEmpty: false
method: BASIC
negateMatches: false
partial: false
pattern: string
replaceAll: false
trim: false
label: string

Propertiesโ€‹

PropertyTypeRequiredDefault
actionstringNo-
fieldMatcherTextMatcherNoTextMatcher
labelstringNo-

Property Detailsโ€‹

actionโ€‹

The action can be one of the following:

"action"="[keepFirst|keepLast|mergeWith:separator]"

  • keepFirst: Keeps the first occurrence found.
  • keepLast: Keeps the last occurrence found.
  • mergeWith:<sep>: Merges all values into one, separated by <sep>..

If you do not specify any action, the default behavior is to merge all occurrences, joining values with a comma.

fieldMatcherโ€‹

Matches document fields based on specified patterns and methods

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.