Connector Framework Server 12.12

# extract_metadata

The `extract_metadata` function extracts metadata from the file associated with a document.

TIP: Run a Lua script using a pre-import task and add the fields `AUTN_NO_FILTER` and `AUTN_NO_EXTRACT` to any document on which you use this function. This prevents metadata being extracted twice.

## Syntax

    extract_metadata( document, params )

## Arguments

Argument | Description
--- | ---
`document` | (LuaDocument) The document to which you want to add metadata.
`params` | (table) A table of additional parameters that configure the task. The table maps parameter names (String) to parameter values. For information about the parameters that you can set, see the following table. For information about how to use named parameters refer to the Connector Framework Server Administration Guide.

## Named Parameters

Named Parameter | Description | Configuration Parameter
--- | --- | ---
`section` | The name of a section in the CFS configuration file that contains settings for the task. If you set this then any parameters not set in the `params` table are read from this section of the configuration file. |
`fieldname_prefix` | The prefix to add to the names of all metadata fields that are added to the document. | FieldnamePrefix
`reserved_fieldnames` | A comma-separated list of field names that the task must not use. If the task needs to add a metadata field with one of the specified names, it prefixes the name with an underscore. | ReservedFieldnames

## Returns

Boolean. Returns `true` if the metadata is successfully added to the document.

## Examples

The following example runs the `ExtractMetadata` task on a document using the settings in the `[ExtractMetadataSettings]` section of the CFS configuration file:

    function handler( document )
       document:setFieldValue( "AUTN_NO_FILTER", "TRUE" );
       document:setFieldValue( "AUTN_NO_EXTRACT", "TRUE" );
       return extract_metadata(document, {section="ExtractMetadataSettings"});
    end

The following example also uses the settings in the `[ExtractMetadataSettings]` section of the CFS configuration file, but overrides the value of the `FieldnamePrefix` configuration parameter:

    function handler( document )
       document:setFieldValue( "AUTN_NO_FILTER", "TRUE" );
       document:setFieldValue( "AUTN_NO_EXTRACT", "TRUE" );
       return extract_metadata(document, {section="ExtractMetadataSettings" ,
             fieldname_prefix="MyMetadataField" });
    end

© Copyright 2022 Micro Focus or one of its affiliates
Version 12.12 | Last updated June 2022

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 swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Connector Framework Server 12.12

Topic Title: extract_metadata