Class CountMatchesTransformerConfig
- All Implemented Interfaces:
Labelable
Counts the number of matches of a given string (or string pattern) and store the resulting value in a field in the specified "toField".
If no "fieldMatcher" expression is specified, the document content will be used. If the "fieldMatcher" matches more than one field, the sum of all matches will be stored as a single value. More often than not, you probably want to set your "countMatcher" to "partial".
Storing values in an existing field
If a target field with the same name already exists for a document,
the count value will be added to the end of the existing value list.
It is possible to change this default behavior
with setOnSet(PropertySetter).
Can be used as a pre-parse tagger on text document only when matching strings on document content, or both as a pre-parse or post-parse handler when the "fieldMatcher" is used.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanGets the count matcher.Gets the field matcher.intThe maximum number of characters to read from content for tagging at once.getOnSet()Gets the property setter to use when a value is set.The target field.inthashCode()setCountMatcher(TextMatcher countMatcher) Sets the count matcher.setFieldMatcher(TextMatcher fieldMatcher) Sets the field matcher.setMaxReadSize(int maxReadSize) The maximum number of characters to read from content for tagging at once.setOnSet(PropertySetter onSet) Gets the property setter to use when a value is set.setSourceCharset(Charset sourceCharset) setToField(String toField) The target field.toString()Methods inherited from class com.norconex.importer.handler.BaseLabelableConfig
getLabel, setLabel
-
Constructor Details
-
CountMatchesTransformerConfig
public CountMatchesTransformerConfig()
-
-
Method Details
-
getFieldMatcher
Gets the field matcher.- Returns:
- field matcher
-
setFieldMatcher
Sets the field matcher.- Parameters:
fieldMatcher- field matcher
-
getCountMatcher
Gets the count matcher.- Returns:
- count matcher
-
setCountMatcher
Sets the count matcher.- Parameters:
countMatcher- count matcher
-
getSourceCharset
-
getToField
The target field.- Returns:
- target field
-
getOnSet
Gets the property setter to use when a value is set.- Returns:
- property setter
-
getMaxReadSize
public int getMaxReadSize()The maximum number of characters to read from content for tagging at once. Default isTextReader.DEFAULT_MAX_READ_SIZE.- Returns:
- maximum read size
-
setSourceCharset
- Returns:
this.
-
setToField
The target field.- Parameters:
toField- target field- Returns:
this.
-
setOnSet
Gets the property setter to use when a value is set.- Parameters:
onSet- property setter- Returns:
this.
-
setMaxReadSize
The maximum number of characters to read from content for tagging at once. Default isTextReader.DEFAULT_MAX_READ_SIZE.- Parameters:
maxReadSize- maximum read size- Returns:
this.
-
equals
- Overrides:
equalsin classBaseLabelableConfig
-
canEqual
- Overrides:
canEqualin classBaseLabelableConfig
-
hashCode
public int hashCode()- Overrides:
hashCodein classBaseLabelableConfig
-
toString
- Overrides:
toStringin classBaseLabelableConfig
-