Overview
To modify a search request, the outgoing query to the indexed catalog is intercepted and any of the available Klevu API parameters are available to be inserted, or adjusted as needed.
There are two steps:
- Reference the API to understand what parameters are available to meet the objective
- Attach the override to the appropriate outgoing query (or queries)
Any of the Klevu API parameters are available to be applied as needed or otherwise to override any default values.
For example, the following snippet of an outgoing productList API Request assigns the value of "10" as the number of filter options to return.
See : Klevu API documentation on Retrieving Filters for more details and options
The query parameters are directly added or replaced by using the klevu.modifyRequest function.
The parameter object notation corresponds to that used in the outgoing JSON API query
For example, the following example snippet modifies the outgoing productList API Query by assigning the value of "20" as the number of filter options to return.
The following full object notation syntax is also acceptable.
Advanced data objects or modules can be accessed using a callback function as the parameter object
Note that each klevu.modifyRequest function requires definition within the corresponding scope of the override. We will chart these below.
Scope | Description |
---|---|
all | Applies to all scope modules |
quick | QuickSearch module |
landing | SRLP module |
catnav | Category module |
full_page | Both SRLP and Category modules (same as "landing,catnav") |
Multiple klevu.modifyRequest functions can be applied in the same or mixed scope.
Please see the Modify Request Examples section for details of common uses.
.