Skip to main content

DocumentLengthTransformer

Adds the document length to a specified field

Notesโ€‹

The length is the document content length as it is in its current processing stage. If for instance you set this transformer after a transformer that modifies the content, the obtained length will be for the modified content, and not the original length. To obtain a document's length before any modification was made to it, use this transformer as one of the first handler in your pre-parse handlers.

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.

Parser Handler Compatibilityโ€‹

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

Examplesโ€‹

The following example stores the document length into a "docSize" field.

handler:
class: DocumentLengthTransformer
toField: docSize

Usageโ€‹

Full configuration skeleton, with every option and its default
class: DocumentLengthTransformer
label: string
onSet: APPEND
toField: string

Propertiesโ€‹

PropertyTypeRequiredDefault
labelstringNo-
onSetenumNo-
toFieldstringNo-

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โ€‹

What to do if a target field of the same name already exist.

Allowed Valuesโ€‹

  • APPEND
  • PREPEND
  • REPLACE
  • OPTIONAL

toFieldโ€‹

A target field name used to store the value.