Class UrlExtractorTransformerConfig
- All Implemented Interfaces:
Labelable,ChunkedTextSupport
Extracts unique URLs matching specific patterns in plain text content and store them in a given field.
URL-matching patterns used are relatively simple. It looks for strings
starting with http://, https://,
or www.. The later is prefixed with https://
when encountered (to make it absolute).
The matching is case-insensitive. If you need alternate ways to detect URLs,
you can use a combination of RegexTransformer,
ReplaceTransformer, or
create your own implementation.
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.
If no URLs are found, the target field values (if any) are left intact.
Content source
It is possible to specify a fromField
as the source of the text to use instead of using the document content.
This class is typically e used as a post-parsing handler only (to ensure we are dealing with text).
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanGets field matcher for fields containing text.intThe maximum number of characters to read from content for tagging at once.getOnSet()The property setter to use when a value is set.inthashCode()setFieldMatcher(TextMatcher fieldMatcher) Sets the field matcher for fields containing text.setMaxReadSize(int maxReadSize) The maximum number of characters to read from content for tagging at once.setOnSet(PropertySetter onSet) The property setter to use when a value is set.setSourceCharset(Charset sourceCharset) setToField(String toField) toString()Methods inherited from class com.norconex.importer.handler.BaseLabelableConfig
getLabel, setLabel
-
Constructor Details
-
UrlExtractorTransformerConfig
public UrlExtractorTransformerConfig()
-
-
Method Details
-
getFieldMatcher
Gets field matcher for fields containing text.- Specified by:
getFieldMatcherin interfaceChunkedTextSupport- Returns:
- field matcher
-
setFieldMatcher
Sets the field matcher for fields containing text.- Parameters:
fieldMatcher- field matcher
-
getToField
-
getOnSet
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.- Specified by:
getMaxReadSizein interfaceChunkedTextSupport- Returns:
- maximum read size
-
getSourceCharset
- Specified by:
getSourceCharsetin interfaceChunkedTextSupport
-
setToField
- Returns:
this.
-
setOnSet
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.
-
setSourceCharset
- Returns:
this.
-
equals
- Overrides:
equalsin classBaseLabelableConfig
-
canEqual
- Overrides:
canEqualin classBaseLabelableConfig
-
hashCode
public int hashCode()- Overrides:
hashCodein classBaseLabelableConfig
-
toString
- Overrides:
toStringin classBaseLabelableConfig
-