Class ScriptCondition
java.lang.Object
com.norconex.importer.handler.condition.impl.ScriptCondition
- All Implemented Interfaces:
Configurable<ScriptConditionConfig>,Condition,ConfigurableCondition<ScriptConditionConfig>,FailablePredicate<DocHandlerContext,IOException>
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:
-
Field Summary
Fields inherited from interface com.norconex.commons.lang.config.Configurable
PROPERTYFields inherited from interface org.apache.commons.lang3.function.FailablePredicate
FALSE, TRUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleaninthashCode()booleantest(DocHandlerContext docCtx) toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.commons.lang3.function.FailablePredicate
and, negate, or
-
Constructor Details
-
ScriptCondition
public ScriptCondition()
-
-
Method Details
-
test
- Specified by:
testin interfaceFailablePredicate<DocHandlerContext,IOException> - Throws:
IOException
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getConfiguration
- Specified by:
getConfigurationin interfaceConfigurable<ScriptConditionConfig>
-