Knowledge Discovery 25.1
Knowledge Discovery Expert

# Write Lua Scripts

A Lua script that is run by CFS must have the following structure:

Copy

    function handler(document)
    ...
    end

The `handler` function is called for each document and is passed a document object. The document object is an internal representation of the document being processed. Modifying this object changes the document.

To continue processing the document, the `handler` function must return `true`. If the function returns `false`, the document is discarded.

A Lua script can terminate due to an error, for example if you use the Lua `error` function or call a Lua function that causes an error. If this happens, CFS continues to process the document, but places an error message in the `ImportErrorDescription` field.

After you have written a Lua script, you must set up an import task or index task A processing task run by CFS on documents. Update-index tasks run when a document's metadata (but not its content) is updated. Delete-index tasks run when a document is deleted from a repository. to run it. Import tasks and index tasks are defined in the CFS configuration file.

Copyright 2024 Open Text
Version 25.1 | Last updated January 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery 25.1

Topic Title: Write Lua Scripts