Query Manipulation Server 26.2
Query Manipulation Server Help

# Use a Request Cooker

A request cooker can arbitrarily modify a request. For example, you can use a request cooker to add extra parameters to any query that is sent to QMS. Request cookers are flexible and allow you to use custom rules to manipulate queries. The request cooker can be an external service, or you can use a Lua script.

When you use a request cooker, QMS sends the original action to the cooker. The cooker returns the modified request, and QMS applies whitelist, then blacklist, and then query text processing to it as necessary.

The cooker must specify the whole action to use.

You can also use an expanded request cooker to modify the request after QMS has applied any rules. See Use an Expanded Request Cooker.

## Request Cooker Lua Scripts

The Lua script must provide a globally accessible `cook_request` function, which accepts a string representation of the request as its only argument. The function must return a Lua table. The keys of this table are the parameter names to use in the action (the parameter names must be in lower case). The table values are the corresponding request values.

QMS loads the Lua script for every request that it cooks. This means that any changes to the script are reflected immediately in the query behavior.

The following example request cooker Lua script sets `MaxResults` to `10` for all queries:

    -- load module that provides string to table request parser
    aci = require "autn_aci"
    -- Set maxresults to 10 on every query
    function cook_request(request_string)
      cooked_request = aci.parse_request_string(request_string)
      cooked_request["maxresults"] = 10
      return cooked_request
    end

NOTE: This example assumes that the `autn_aci.lua` file is in the same directory as your script.

You can use the Knowledge Discovery Lua libraries in your Lua scripts. For more information about the available functions and methods, see Lua Functions and Methods Reference.

## Configure the Request Cooker

The following procedure describes how to configure QMS to use a request cooker from an external service, or a Lua script.

To use a request cooker

1. Open the QMS configuration file in a text editor.

2. Add a `[RequestCooker]` section to the QMS configuration file.

   - To use a custom Lua script to manipulate requests, set Mode to `lua`, and set Script to the path to the script that you want to use. For example:

         [RequestCooker]
         Mode=lua
         Script=scripts\cookrequest-maxresults.lua

   - To use an external server to manipulate requests, set Mode to `legacy`, and specify the host and port of the server. For example:

         [RequestCooker]
         Mode=legacy
         Host=12.3.4.56
         Port=8080

3. Send queries to QMS with the CookRequest parameter set to `True`.

   If you want to cook all requests that you send to QMS, set the CookAllRequests configuration parameter to `True`.

   NOTE: When you set CookAllRequests to `True`, QMS does not retrieve or process cardinal placements.

For more information on how to configure request cooking, see Request Cooker Parameters.

Copyright 2026 Open Text
Version 26.2 | Last updated April 2026

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 Query Manipulation Server 26.2

Topic Title: Use a Request Cooker