The write_idx function writes a document to disk as an IDX file. If you specify the name of an existing IDX file, the document is appended to the file.
write_idx( doc, outputFilename [, archiveDirectory [, maxSizeKBs [, shouldUseSections]]] )
| Argument | Description |
|---|---|
doc
|
(LuaDocument) The document to be written to an IDX file. |
outputFilename
|
(string) The filename of the output IDX file. |
archiveDirectory
|
(string) The folder to which IDX files are archived when they reach the maximum size. The default folder is the current directory (.) |
maxSizeKBs
|
(integer) The maximum size of an IDX file (in kilobytes) before it is archived. To specify no maximum size, use the value -1. This is the default setting. |
shouldUseSections
|
(string) Specifies whether to divide the document into sections.
|
Boolean. Returns true if the IDX file was created successfully, and false otherwise.
function handler(document) return write_idx(document, "my_new_idx_file") end
function handler(document)
local was_idx_written = write_idx(document,
"idx_files/main_file.idx", "archive_idx_files", 1024, "true")
return was_idx_written
end
|
|