Store Content in IDOL Server > Process Data before you Index > Use Lua Script Index Tasks > Write a Lua Index Task

Write a Lua Index Task
The script should have this structure:
function handler(document)
...
end
The handler function is called for each document and is passed a document object. This is an internal representation of the document being processed. Modifying this object will change the document.
 
NOTE You can write a library of useful functions to share between multiple scripts, which you can then include in the scripts by adding dofile(“library.lua”) to the top of the lua script outside of the handler function.
Supported Functions
These functions are supported:
 
Related Topics 
*
*
*
Flush Handler Functions
You can use the following optional function, which is called by the IDOL server lua task when all documents in an index job have been processed.
function flush_handler()
...
end
For example, you could write a lua script task that saves the document references of incoming documents until it has a batch of 10 documents, and then sends them in an HTTP call. You can then use the flush_handler function to determine the behaviour in the event that all documents have been indexed and a full batch has not be created (if there are fewer than 10 documents in the next batch when indexing is complete).