SplitTransformer
Splits an existing metadata value into multiple values
Notes
Dividing processing based on a given value separator (the separator gets discarded). The "toField" argument is optional (the same field will be used to store the splits if no "toField" is specified"). Duplicates are removed.
Can be used both as a pre-parse (metadata or text content) or post-parse handler.
If no "fieldMatcher" expression is specified, the document content will be used. If the "fieldMatcher" matches more than one field, they will all be split and stored in the same multi-value metadata field.
Storing values in an existing field
If a target field with the same name already exists for a document, values will be added to the end of the existing value list. It is possible to change this default behavior by supplying a PropertySetter.
Examples
The following example splits a single value field holding a comma-separated list into multiple values.
- YAML
- JSON
- XML
handler:
class: SplitTransformer
operations:
- separator: \s*,\s*
separatorRegex: true
fieldMatcher:
pattern: myField
{
"handler": {
"class": "SplitTransformer",
"operations": [
{
"separator": "\\s*,\\s*",
"separatorRegex": true,
"fieldMatcher": {
"pattern": "myField"
}
}
]
}
}
<handler>
<class>SplitTransformer</class>
<operations>
<op>
<separator>s*,s*</separator>
<separatorRegex>true</separatorRegex>
<fieldMatcher>
<pattern>myField</pattern>
</fieldMatcher>
</op>
</operations>
</handler>
Usage
Full configuration skeleton, with every option and its default
- YAML
- JSON
- XML
class: SplitTransformer
label: string
operations:
- fieldMatcher: {}
onSet: APPEND
separator: string
separatorRegex: false
toField: string
{
"class": "SplitTransformer",
"label": "string",
"operations": [
{
"fieldMatcher": {},
"onSet": "APPEND",
"separator": "string",
"separatorRegex": false,
"toField": "string"
}
]
}
<handler>
<class>SplitTransformer</class>
<label>string</label>
<operations>
<op>
<fieldMatcher/>
<onSet>APPEND</onSet>
<separator>string</separator>
<separatorRegex>false</separatorRegex>
<toField>string</toField>
</op>
</operations>
</handler>
Properties
| Property | Type | Required | Default |
|---|---|---|---|
label | string | No | - |
operations | SplitOperation[] | 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.
operations
A list of DOM extraction operations to perform, each targeting a specific element selector and specifying what to extract and where to store it.