Connector Framework Server 25.1
Connector Framework Server Help

# HashN

The `HashN` parameter specifies a Lua script to use for family hashing. The script should insert an MD5 field into the document, which is a hash of the document’s unique fields. To use this you must set `ImportHashFamilies`=`true`.

If the Lua script returns `false` then the hash is calculated from the whole of the original document (it does not matter whether the document is text or binary). Your script should return `true` only when it has set a field called "MD5" containing the hash to use for the document.

In the example below, `hash.lua` is used to generate the hash for each document. An example `hash.lua` is given below:

    function handler(document)
    	if document:getFieldValue("MAIL") == "TRUE" then
    		local toHash =
    		  allValues(document, "To" ) .. "||" ..
    		  allValues(document, "From" ) .. "||" ..
    		  allValues(document, "Subject" ) .. "||" ..
    		  allValues(document, "Sent" );

    		document:addField( "MD5", hash_string( toHash, "MD5" ) );
    		return true;
    	end

    	return false;
    end

    function allValues(document, fieldName)
    	return table.concat({ document:getFieldValues(fieldName) }, ";");
    end

When this script is used, if the document has a field called "MAIL" set to "TRUE" then the hash is generated from the "To", "From", "Subject" and "Sent" fields. For all other items the whole document is used to generate the hash.

Type: | String
Default: | None
Required: | No
Configuration Section: | ImportTasks
Example: | `Hash0=Lua:hash.lua`
See Also | ImportHashFamilies ImportFamilyRootExcludeFmtCSV

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 Connector Framework Server 25.1

Topic Title: HashN