---
title: Examples
slug: template-js/modify-request-example
docTags: 
createdAt: 2023-06-15T16:33:50.000Z
---

# Modify Request

Below are some common uses of modifying the query request. You can find guides for more elaborate customizations within the **How-To** section of the Template JS documentation.

Please review : The Modify Request [Overview](docId:_ndrEPmgAUhYltIlXkG-o) for complete details on the syntax used for modifying the outgoing query.



## Facet/Filter Options Count

Increase the default maximum number of filter options (10) to "20" for every query.

```javascript
klevu.modifyRequest("all", function (data, scope) {
  klevu.each(data.request.current.recordQueries, function (key, query) {
    klevu.setObjectPath(query, "filters.filtersToReturn.options.limit", 20);
  })
});
```

| **API Parameter** | **Description**                                                  |
| ----------------- | ---------------------------------------------------------------- |
| options.limit     | Specify the maximum number of options to be included per filter. |

See : Klevu [API documentation on Retrieving Filters](https://docs.klevu.com/apis/faceting) for more details and options




## Run-time Boosting

Influence the relevancy algorithm by assigning `weight` to different aspects at the time of query.

```javascript
klevu.modifyRequest("landing","productList.boost.filters", [
  {
    "key": "brand",
    "values": ["ACME"],
    "weight": 200
  }
]);
```

| **API Parameter** | **Description**                                         |
| ----------------- | ------------------------------------------------------- |
| boost             | Query-level aspects to influence the relevancy rankings |

See : Klevu API [Personalisation](docId\:YFU114Puw2lTVF05GaFWv) for more details and more options

##

## Constrain Result Set (Advanced Filtering)

You can add a `groupCondition` to restrict the result set to specific attributes and values. This constraint is typically applied "behind the scenes" to create specialized result set experiences.

Some examples include:

- Brand specific listings
- Curated landing pages
- Automotive fitment

```javascript
klevu.modifyRequest("landing","productList.settings.groupCondition", {
    "groupOperator": "ALL_OF",
    "conditions": [
        {
            "key": "brand",
            "valueOperator": "INCLUDE",
            "values": [
                "ACME"
            ]
        }
    ]
});
```

| **API Parameter** | **Description**                                                    |
| ----------------- | ------------------------------------------------------------------ |
| groupOperator     | Defines the condition of filtering (`ALL_OF`, `ANY_OF`, `NONE_OF`) |
| conditions        | The array of attributes (`key`) to apply to the condition          |

See : Klevu API [Advanced Filtering](docId\:RbT4zzdIHEIp1lCuk8n-r) for more details and more options
