# Introduction to ReQL

> Source: https://docs.recombee.com/reql

> For the complete documentation index, see [llms.txt](/llms.txt).

**Table of contents**

* [Filtering and Boosting](#filtering-and-boosting)
* [Business Rules](#business-rules)
* [ReQL Code Assistant](#reql-code-assistant)  
   * [Code Generation](#code-generation)  
   * [Explanation of Existing Code](#explanation-of-existing-code)  
   * [Conversations History](#conversations-history)

# Introduction to ReQL

Recombee Query Language (ReQL) provides an elegant way for applying business rules or any other rules to the recommendations. It allows expressions to be evaluated on candidate **items**, telling the recommender how to handle each item based on the **values** of the item's**properties**.

There are two types of the ReQL expressions:

* [**filter**](/reql_filtering_and_boosting#reql-filtering) \- for selecting a subset of items which can be used in recommendation
* [**booster**](/reql_filtering_and_boosting#reql-boosting) \- for preferring some items over the others

You can create your custom filter/booster [Business Rules](#business-rules) in the [Recombee Admin UI](https://admin.recombee.com) and apply them to your [Scenarios](/scenarios).

[AI ReQL Code Assistant](#reql-code-assistant) within the Admin UI can help you with creating the rules - just describe the desired behavior in your natural language.

[![Creating your own Business Rule in Admin UI using ReQL](/img/gui/br1.png)](/img/gui/br1.png)

Creating your own Business Rule in Admin UI using ReQL

Alternatively you can send `filter` and `booster` as parameters of [API recommendation requests](/api#recommendations).

Filters and boosters use the[property values](/api#subsection-values-of-item-properties) of the individual items (or users). Read[this part of Getting Started guide](/getting_started#getting-started-catalog) or[this tutorial](/tutorial#tutorial-catalog) for more information on uploading the item catalog.

All the items have one automatically created property `itemId`.

## Filtering and Boosting

In **filtering**, the expression must return **boolean** value for each item. If the value returned is `true`, the item passed the filter; if the value is `false`, the item does not pass and will be discarded.

[Read more about filtering](/reql_filtering_and_boosting#reql-filtering)

In advanced applications, besides filtering, you may wish to **boost**recommendation rates of some items. In contrast to filtering, where items may be completely blocked, in boosting, you may tell the recommender to **prefer** some items over others.

Indeed, by default, it is a task of the recommender itself to select the items which are the most relevant. However, it may be your policy to purposefully bias the recommender toward your business goals.

[Read more about boosting](/reql_filtering_and_boosting#reql-boosting)

## Business Rules

The _Business Rules_ section in the Admin UI provides a [ReQL](/reql) editor with result previews, along with an [AI ReQL Code Assistant](/reql#reql-code-assistant) that helps generate rules from natural language.

You can define _Input Values_ to reuse a single _Business Rule_ with different configurations across multiple [Scenarios](/scenarios).

For example, you might create a rule that recommends only short (less than 30 minutes), English-language movies:

[![Creating a Business Rule](/img/gui/br1.png)](/img/gui/br1.png)

If you have multiple scenarios requiring different limits, you can make certain values (e.g., max runtime) configurable via **input parameters**:

[![Adding Input Value](/img/gui/br2.png)](/img/gui/br2.png)

[![Adding Input Value](/img/gui/br3.png)](/img/gui/br3.png)

When applying such a rule to a scenario, you can specify the desired input (e.g., runtime in minutes):

[![Applying Business Rule to Scenario](/img/gui/br4.png)](/img/gui/br4.png)

## ReQL Code Assistant

[![ReQL AI Assistant in Admin UI using ReQL](/img/gui/reql_assistant.png)](/img/gui/reql_assistant.png)

ReQL AI Assistant in Admin UI using ReQL

The AI ReQL Code Assistant can help you create ReQL filters and boosters or even [ReQL-based Segmentations](/segmentations#advanced-creating-segmentations).

You can access the assistant by clicking the _Code Assistant_ button in the Business Rules and Item Segmentations sections of the Recombee Admin UI.

### Code Generation

Describe what you want to be the outcome of the rule in **natural language** (it even does not have to be English) and watch the Assistant generate the ReQL code for you.

We recommend that you always validate the generated filters and boosters before applying them.

If you need to make some amendments to the generated code, just continue in the conversation and the assistant will modify the rule according to your needs.

### Explanation of Existing Code

Open the Assistant on an existing rule and get a detailed explanation of how the rule works.

### Conversations History

You can access your conversation history with the Assistant and pick up where you left off.