Connector Framework Server 12.12

# Customize the Query

The `CategorySuggestFromText` Lua script sends an entire document (metadata and content) to IDOL for categorization. The document is converted to a string using the `to_idx` method and then passed to the `QueryText` parameter of the `CategorySuggestFromText` action:

    local categorySuggestFromTextParameters = { QueryText = document:to_idx() }

    ...

    local output = send_aci_action(
    		idolCategorizeHost,
    		idolCategorizePort,
    		"categorysuggestfromtext",
    		categorySuggestFromTextParameters,
    		timeoutMilliseconds,
    		retries,
    		sslParameters
    		)

You can modify the script to categorize the document based on a specific field. For example, to use only the document content:

    local categorySuggestFromTextParameters = {
                          QueryText = document:getContent()
                          }

Alternatively, to use the value of a single document field:

    local categorySuggestFromTextParameters = {
                          QueryText = document:getFieldValue("MyFieldName")
                          }

You can also add additional parameters to the action. For example, the `CategorySuggestFromText` Lua script does not limit the number of categories that are added to the document. To add only the most relevant category to a document, add the `CategorySuggestFromText` action parameter `NumResults=1` by modifying the script as follows:

    local categorySuggestFromTextParameters = {
                          QueryText = document:getContent(),
                          NumResults = 1
                          }

For more information about the `CategorySuggestFromText` action and the parameters that it supports, refer to the IDOL Server Reference.

© 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: Customize the Query