RenameTransformer
Rename metadata fields to different names.
Notes
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.
When using regular expressions, toField can also hold replacement patterns (e.g. $1, $2, etc).
Can be used both as a pre-parse or post-parse handler.
Examples
The above example renames a "dc.title" field to "title", overwriting any existing values in "title".
- YAML
- JSON
- XML
handler:
class: RenameTransformer
operations:
- toField: title
onSet: REPLACE
fieldMatcher:
method: REGEX
pattern: dc.title
{
"handler": {
"class": "RenameTransformer",
"operations": [
{
"toField": "title",
"onSet": "REPLACE",
"fieldMatcher": {
"method": "REGEX",
"pattern": "dc.title"
}
}
]
}
}
<handler>
<class>RenameTransformer</class>
<operations>
<op>
<toField>title</toField>
<onSet>REPLACE</onSet>
<fieldMatcher>
<method>REGEX</method>
<pattern>dc.title</pattern>
</fieldMatcher>
</op>
</operations>
</handler>
Usage
Full configuration skeleton, with every option and its default
- YAML
- JSON
- XML
class: RenameTransformer
label: string
operations:
- fieldMatcher: {}
onSet: APPEND
toField: string
{
"class": "RenameTransformer",
"label": "string",
"operations": [
{
"fieldMatcher": {},
"onSet": "APPEND",
"toField": "string"
}
]
}
<handler>
<class>RenameTransformer</class>
<label>string</label>
<operations>
<op>
<fieldMatcher/>
<onSet>APPEND</onSet>
<toField>string</toField>
</op>
</operations>
</handler>
Properties
| Property | Type | Required | Default |
|---|---|---|---|
label | string | No | - |
operations | RenameOperation[] | 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.