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.