Class RegexTransformerConfig
- All Implemented Interfaces:
Labelable,ChunkedTextSupport
Extracts field names and their values with regular expression.
This is done by using
match groups in your regular expressions (parenthesis). For each pattern
you define, you can specify which match group hold the field name and
which one holds the value.
Specifying a field match group is optional if a field
is provided. If no match groups are specified, a field
is expected.
If "fieldMatcher" is specified, it will use content from matching fields and storing all text extracted into the target field, multi-value. Else, the document content is used.
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.
This class can be used as a pre-parsing handler on text documents only or a post-parsing handler.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanGets source field matcher for fields on which to extract fields/values.intGets the patterns used to extract matching field names/values.inthashCode()setFieldMatcher(TextMatcher fieldMatcher) Sets source field matcher for fields on which to extract fields/values.setMaxReadSize(int maxReadSize) setPatterns(List<RegexFieldValueExtractor> patterns) Sets one or more patterns that will extract matching field names/values.setSourceCharset(Charset sourceCharset) toString()Methods inherited from class com.norconex.importer.handler.BaseLabelableConfig
getLabel, setLabel
-
Constructor Details
-
RegexTransformerConfig
public RegexTransformerConfig()
-
-
Method Details
-
setPatterns
Sets one or more patterns that will extract matching field names/values. Clears previously set pattterns.- Parameters:
patterns- field extractor pattern
-
getPatterns
Gets the patterns used to extract matching field names/values.- Returns:
- patterns
-
getFieldMatcher
Gets source field matcher for fields on which to extract fields/values.- Specified by:
getFieldMatcherin interfaceChunkedTextSupport- Returns:
- field matcher
-
setFieldMatcher
Sets source field matcher for fields on which to extract fields/values.- Parameters:
fieldMatcher- field matcher
-
getMaxReadSize
public int getMaxReadSize()- Specified by:
getMaxReadSizein interfaceChunkedTextSupport
-
getSourceCharset
- Specified by:
getSourceCharsetin interfaceChunkedTextSupport
-
setMaxReadSize
- Returns:
this.
-
setSourceCharset
- Returns:
this.
-
equals
- Overrides:
equalsin classBaseLabelableConfig
-
canEqual
- Overrides:
canEqualin classBaseLabelableConfig
-
hashCode
public int hashCode()- Overrides:
hashCodein classBaseLabelableConfig
-
toString
- Overrides:
toStringin classBaseLabelableConfig
-