Open topic with navigation

# 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.

© 2016 Hewlett Packard Enterprise Development LP | Send documentation feedback to HPE Close Send Documentation Feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to AutonomyTPFeedback@hpe.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_HP_HTML5_bannerTitle.htm