Class ScriptCondition

java.lang.Object
com.norconex.importer.handler.condition.impl.ScriptCondition
All Implemented Interfaces:
Configurable<ScriptConditionConfig>, Condition, ConfigurableCondition<ScriptConditionConfig>, FailablePredicate<DocHandlerContext,IOException>

public class ScriptCondition extends Object implements ConfigurableCondition<ScriptConditionConfig>

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 maxReadSize length).
  • metadata: Document metadata as a Properties object.
  • 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: