Class ScriptConditionConfig
java.lang.Object
com.norconex.importer.handler.BaseLabelableConfig
com.norconex.importer.handler.condition.BaseConditionConfig
com.norconex.importer.handler.condition.impl.ScriptConditionConfig
- All Implemented Interfaces:
Labelable
A condition formulated using a scripting language.
Refer to ScriptRunner for more information on using a scripting
language with Norconex Importer.
How to create a condition with scripting:
The following are variables made available to your script for each document:
- reference: Document unique reference as a string.
- content: Document content, as a string
(of
maxReadSizelength). - metadata: Document metadata as a
Propertiesobject. - parsed: Whether the document was already parsed, as a boolean.
- sectionIndex: Content section index (integer) if it had to be
split because it was too large (as per
maxReadSize).
The expected return value from your script is a boolean indicating whether the document was matched or not.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanGets this filter field matcher.intThe maximum number of characters to read at once, used for filtering.The presumed source character encoding.inthashCode()setEngineName(String engineName) setFieldMatcher(TextMatcher fieldMatcher) Sets this condition field matcher.setMaxReadSize(int maxReadSize) The maximum number of characters to read at once, used for filtering.setSourceCharset(Charset sourceCharset) The presumed source character encoding.toString()Methods inherited from class com.norconex.importer.handler.BaseLabelableConfig
getLabel, setLabel
-
Constructor Details
-
ScriptConditionConfig
public ScriptConditionConfig()
-
-
Method Details
-
getFieldMatcher
Gets this filter field matcher.- Returns:
- field matcher
-
setFieldMatcher
Sets this condition field matcher.- Parameters:
fieldMatcher- field matcher
-
getEngineName
-
getScript
-
getSourceCharset
The presumed source character encoding. Usually ignored and presumed to be UTF-8 if the document has been parsed already.- Returns:
- character encoding of the source to be transformed
-
getMaxReadSize
public int getMaxReadSize()The maximum number of characters to read at once, used for filtering. Default isTextReader.DEFAULT_MAX_READ_SIZE.- Returns:
- maximum read size
-
setEngineName
- Returns:
this.
-
setScript
- Returns:
this.
-
setSourceCharset
The presumed source character encoding. Usually ignored and presumed to be UTF-8 if the document has been parsed already.- Parameters:
sourceCharset- character encoding of the source to be transformed- Returns:
this.
-
setMaxReadSize
The maximum number of characters to read at once, used for filtering. 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
-