Class DocumentLengthTransformer
- All Implemented Interfaces:
Configurable<DocumentLengthTransformerConfig>,ConfigurableDocHandler<DocumentLengthTransformerConfig>,DocHandler
Adds the document length (i.e., number of bytes) to
the specified field. The length is the document
content length as it is in its current processing stage. If for
instance you set this tagger 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 tagger as one of the first
handler in your pre-parse handlers.
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.
Can be used both as a pre-parse or post-parse handler.
The following stores the document lenght into a "docSize" field.
- See Also:
-
Field Summary
Fields inherited from interface com.norconex.commons.lang.config.Configurable
PROPERTYFields inherited from interface com.norconex.importer.handler.DocHandler
NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanbooleanhandle(DocHandlerContext docCtx) Perform any operations on a document.inthashCode()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.norconex.importer.handler.DocHandler
close, init
-
Constructor Details
-
DocumentLengthTransformer
public DocumentLengthTransformer()
-
-
Method Details
-
handle
Description copied from interface:DocHandlerPerform any operations on a document.- Specified by:
handlein interfaceDocHandler- Parameters:
docCtx- the document handling context- Returns:
falseto stop processing and reject a document ortrueto proceed to the next configured handler.- Throws:
IOException- An I/O exception of some sort has occurred
-
getConfiguration
- Specified by:
getConfigurationin interfaceConfigurable<DocumentLengthTransformerConfig>
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-