Set non CGI query processor options in hook script

Background

Funnelback’s parameters are generally either set as collection.cfg parameters, or passed in as CGI parameters when a query is made.

It is often desirable to set certain parameters dynamically via a hook script. This is easily achieved by injecting items into the data model’s input parameters - however this only works for options that can be set as CGI parameters.

This article shows how to set non-CGI parameter options from within a hook script.

Set a normal (CGI enabled) parameter via a hook script

The following pre-process hook script shows how parameters are normally set via a hook script:

//e.g. setting the num_ranks query processor option
transaction?.question?.inputParameterMap['num_ranks'] = '100'
Solution

Set special parameters via a hook script

For non CGI query processor options set the parameter in the transaction.question.dynamicQueryProcessorOptions element within the data model.

The following pre-process hook script shows how to set a special parameter via a hook script:

# e.g. setting '-daat=0'
transaction?.question?.dynamicQueryProcessorOptions << '-daat=0'
You should never remove existing options set within the dynamicQueryProcessorOptions as these are configured by the product itself and could potentially caused unintended issues and problems for upgrades.

Why are there non CGI query processor options?

Some query processor options can not be set via a CGI parameter for the following reasons:

  • The option can have major affect to query processing time.

  • The option has security implications and should not be able to be set by a user.