Plugin: Map URL parameters
Other versions of this plugin may exist. Please ensure you are viewing the documentation for the version that you are currently using. If you are not running the latest version of your plugin we recommend upgrading. See: list of all available versions of this plugin. |
Purpose
Maps URL parameters to alternate data model input parameters when a query runs.
This plugin enables you to map non-standard URL parameters to the equivalent Funnelback parameters.
Usage
Enable the plugin
Enable the map-url-parameters plugin on your results page from the Extensions screen in the administration dashboard or add the following results page configuration to enable the plugin.
plugin.map-url-parameters.enabled=true
plugin.map-url-parameters.version=1.0.0
The plugin will take effect as soon as it is enabled. |
Plugin configuration settings
The following options can be set in the results page configuration to configure the plugin:
-
plugin.map-url-parameters.config.rewrite.<URL-PARAMETER-NAME>=<INPUT-PARAMETER-NAME>
: Maps the<URL-PARAMETER-NAME>
to the<INPUT-PARAMETER-NAME>
input parameter. Supports parameters that are specified multiple times (such as what you might get from form checkboxes). The value of<URL-PARAMETER-NAME>
will be appended to, or replace the following fields in the data model:-
inputParameters["<INPUT-PARAMETER-NAME>"]
-
additionalParameters["<INPUT-PARAMETER-NAME>"]
-
-
plugin.map-url-parameters.config.overwrite.<INPUT-PARAMETER-NAME>=<true|false>
Default:false
: Controls if value of the mapped parameter appends to (default) or overwrites the target input parameter in the data model. When set totrue
, the value of<INPUT-PARAMETER-NAME>
in the data model input parameters will be replaced with the value of the supplied<URL-PARAMETER>
andinputParameters["<URL-PARAMETER-NAME>"]
andadditionalParameters["<URL-PARAMETER-NAME>"]
is removed. When set tofalse
(or not set), the value of<URL-PARAMETER>
will be appended to the<INPUT-PARAMETER-NAME>
field as an additional list item.
Notes:
-
The
collection
input parameter is protected parameter can and cannot be altered. e.g.plugin.map-url-parameters.config.rewrite.<URL-PARAMETER-NAME>=collection
is not allowed and will result in a error being written to the log files. -
<URL-PARAMETER-NAME>
will not appear as a custom key (e.g.inputParameters["<URL-PARAMETER-NAME>"]
) in the data model when it is mapped using this plugin. -
<URL-PARAMETER-NAME>
can only be mapped to a single<INPUT-PARAMETER-NAME>
. If multipleplugin.map-url-parameters.config.rewrite.<URL-PARAMETER-NAME>
keys are set in the results page configuration the first matching value will be used and the other mappings ignored. You can map multiple URL parameters, but each parameter can only be mapped to a single Funnelback input parameter.
Example
Map a non-standard parameter containing the query terms to the Funnelback query parameter
Consider a scenario where you are migrating to a Funnelback search and would like to maintain existing URL parameters.
In this example your query terms are passed in the search via a parameter, q
. Funnelback uses the query
parameter for this purpose the plugin will be configured to map whatever is passed in as the q
value and set this as the value for query
:
plugin.map-url-parameters.config.rewrite.q=query plugin.map-url-parameters.config.overwrite.query=true
If the URL called is something like http://search.example.com/search?q=dog
this will result in the following being set in the Funnelback data model:
question.inputParameters["query"]=["dog"] question.additionalParameters["query"]=["dog"]
the original q parameter will not be passed through to the Funnelback data model as it has been rewritten as query .
|
Map a set of filter
parameters as metadata query constraints
Consider a scenario where you have a search that passes in several filter
values from checkboxes in a form that you wish to add as a metadata constraint to your search.
plugin.map-url-parameters.config.rewrite.filter=meta_searchFilters_orsand
If the URL called is something like http://search.example.com/search?q=dog&filter=small+size&filter=curly+hair
this will result in the following being set in the Funnelback data model:
question.inputParameters["meta_searchFilters_orsand"]=["small size","curly hair"]
If your meta_searchFields_orsand
parameter had any existing values (e.g. question.inputParameters["meta_searchFilters_orsand"] = ["pure bred"]
) set then these will be preserved as the overwrite option is not set and you would result in the following: question.inputParameters["meta_searchFilters_orsand"] = ["pure bred","small size","curly hair"]
.