# Recommendation Logics

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

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

# Recommendation Logics

Logic allows you to specify the desired behavior of the recommendation model.

While Recombee is generally a domain-independent recommendation engine and the default model is optimized to work well in most cases, we have used our experience in some frequent domains to setup some tuned models, and you can now easily pick the logic that is tailored for the particular case.

## Setting Logic in the Admin UI

You can assign a particular logic to a [Scenario](/scenarios) in the [Admin UI](/admin_ui).

[![Setting Logic in the Admin UI](/img/gui/set_logic.png)](/img/gui/set_logic.png)

Alternatively you can [use API parameters to set the logic](#recommendation-logics-set-via-api).

## Setting Logic Using API Parameter

To specify the logic for individual recommendation requests, pass its name (e.g., `ecommerce:homepage`) to the `logic` parameter.

```js
const result = await client.send(
    new recombee.RecommendItemsToUser(
        'user-x', 10,
	    {
		    logic: 'ecommerce:homepage'
	    }
    )
);
```

Most logics include sensible default parameters, but you can customize them to suit your specific needs.

The example below uses a placeholder logic named `example:logic-parameters` to demonstrate how to set various types of parameters.

Note that this logic is just an example and does not exist in the system. The parameter names and values are also for demonstration purposes only. Please refer to the documentation of the specific logic you intend to use for the correct parameter names and expected values.

```js
const result = await client.send(new recombee.RecommendItemsToUser('user-x', 10,
	{
		logic: {
			name: 'example:logic-parameters',
			settings: {
                // basic types
                boolean: true,
                double: 3.14,
                int: 42,
                string: 'example',
                stringArray: ['value1', 'value2', 'value3'],
				
                // available keys: days, hours, minutes, seconds
                duration: { days: 3, hours: 12 },
               
                // one of possible values: e.g. 'ascending', 'descending'
                enum: 'ascending',

                // array of possible values, e.g. 'cartAdditions', 'purchases', 'views' (duplicates allowed)
                enumArray: ['cartAdditions', 'cartAdditions', 'purchases'],

                // set of possible values, e.g. 'cartAdditions', 'purchases', 'views' (duplicates not allowed)
                enumSet: ['cartAdditions'],

                // array of item IDs
                itemIdsArray: ['item1', 'item2', 'item3'],

                // name of the item segmentation
                itemSegmentation: 'segmentationName',

                // name of the item/user property
                property: 'category',

                // ReQL filter expression as a string
                reqlFilter: `'category' == "electronics"`,

                // 'since' and 'until' should be ISO 8601 format strings or Unix timestamps
                timeInterval: { since: '2024-01-01T00:00:00Z', until: '2024-12-31T23:59:59Z' },
			}
		}
	})
);
```

## List of Logics

The logics available for most databases are grouped by domain, see the list below or the left-side navigation.

Some databases tweaked by the Recombee support team may have custom logics not specified here.

Tip

See [Integration Tips](/integration_tips) if you are not sure which logic should be used in your use case.

### [Universal Models](/logics/universal)

| Name                                                                                                 | Description                                                                                                                                                                                                                                       |
| ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [recombee:default](/logics/universal#recombee-default)                                               | Default model ensemble aiming to work well in most common use cases.                                                                                                                                                                              |
| [recombee:homepage](/logics/universal#recombee-homepage)                                             | Universal model ensemble suitable for putting recommendations on the homepage / welcome-screen scenarios.                                                                                                                                         |
| [recombee:personal](/logics/universal#recombee-personal)                                             | Universal model ensemble suitable for user-based recommendations reflecting the personal tastes of the current user.                                                                                                                              |
| [recombee:similar](/logics/universal#recombee-similar)                                               | Universal model ensemble suitable for either recommending items which are similar to the given item (in case of Items-to-Item recommendation), or recommending users who are similar to the given user (in case of Users-to-User recommendation). |
| [recombee:popular](/logics/universal#recombee-popular)                                               | Universal model suitable for recommending globally popular items, taking into account all interaction types.                                                                                                                                      |
| [recombee:popular-segments](/logics/universal#recombee-popular-segments)                             | Universal model ensemble suitable for recommending globally popular segments.                                                                                                                                                                     |
| [recombee:recently-viewed](/logics/universal#recombee-recently-viewed)                               | Model returning the list of recently viewed items for a particular user.                                                                                                                                                                          |
| [recombee:visually-similar](/logics/universal#recombee-visually-similar)                             | Model recommending similar items based on visual similarity (using deep-learning neural networks to process the images provided through the image properties).                                                                                    |
| [recombee:similar-properties](/logics/universal#recombee-similar-properties)                         | Model recommending similar items based on item properties (numerical values, sets, and texts).                                                                                                                                                    |
| [recombee:emailing](/logics/universal#recombee-emailing)                                             | Model ensemble suitable for recommending items in periodic e-mailing campaigns.                                                                                                                                                                   |
| [recombee:custom-sort](/logics/universal#recombee-custom-sort)                                       | Model suitable for recommending items ordered by a ReQL expression given as a booster                                                                                                                                                             |
| [recombee:related-to-segment](/logics/universal#recombee-related-to-segment)                         | Recommends items that are contextually related to the [Item Segment](https://docs.recombee.com/segmentations) and should be of interest to the user.                                                                                              |
| [recombee:personal-from-segment](/logics/universal#recombee-personal-from-segment)                   | Recommends items from the [Item Segment](https://docs.recombee.com/segmentations), tailored to the user's preferences.                                                                                                                            |
| [recombee:popular-from-segment](/logics/universal#recombee-popular-from-segment)                     | Recommends the most popular items within the [Item Segment](https://docs.recombee.com/segmentations), based on overall engagement.                                                                                                                |
| [recombee:items-from-top-segment-for-you](/logics/universal#recombee-items-from-top-segment-for-you) | This Composite Logic provides a comprehensive recommendation in a single response consisting of…                                                                                                                                                  |
| [recombee:because-you-interacted](/logics/universal#recombee-because-you-interacted)                 | This Composite Logic delivers two results within a single response consisting of…                                                                                                                                                                 |
| [recombee:swiping-feed](/logics/universal#recombee-swiping-feed)                                     | This Logic is designed for infinite swiping feed experiences (such as reels or short-form video feeds), where users continuously browse content and can express feedback through likes or dislikes.                                               |

### [Search](/logics/search)

| Name                                                              | Description                                                                                                                                   |
| ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| [search:personalized](/logics/search#search-personalized)         | Smart personalized fulltext search which takes into account both the search query and the personal preferences of the user.                   |
| [search:non-personalized](/logics/search#search-non-personalized) | Non-personalized fulltext search, based purely on how well the search query is matched.                                                       |
| [search:semantic](/logics/search#search-semantic)                 | Semantic search utilizes a large language model (LLM) to improve search accuracy by understanding the intent and context behind user queries. |

### [E-commerce](/logics/e-commerce)

| Name                                                                                                            | Description                                                                                                                               |
| --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| [ecommerce:homepage](/logics/e-commerce#ecommerce-homepage)                                                     | Model ensemble suitable for recommending products on homepage/welcome page in E-Commerce and online retail systems.                       |
| [ecommerce:similar-products](/logics/e-commerce#ecommerce-similar-products)                                     | Model ensemble suitable for recommending similar products (alternatives) to a source (currently viewed) product.                          |
| [ecommerce:cross-sell](/logics/e-commerce#ecommerce-cross-sell)                                                 | Model ensemble suitable for recommending compatible/complementary products.                                                               |
| [ecommerce:bestseller](/logics/e-commerce#ecommerce-bestseller)                                                 | Model suitable for recommending globally most purchased items.                                                                            |
| [ecommerce:similarly-purchasing](/logics/e-commerce#ecommerce-similarly-purchasing)                             | Recommends users with similar purchasing behavior as the source user.                                                                     |
| [ecommerce:products-from-top-category-for-you](/logics/e-commerce#ecommerce-products-from-top-category-for-you) | This Composite Logic provides personalized product recommendations within a single response, tailored to the user's shopping preferences… |
| [ecommerce:products-from-top-segment-for-you](/logics/e-commerce#ecommerce-products-from-top-segment-for-you)   | This Composite Logic delivers personalized product recommendations in a single response…                                                  |
| [ecommerce:because-you-purchased](/logics/e-commerce#ecommerce-because-you-purchased)                           | This Composite Logic provides personalized product recommendations based on the user's past purchases, all within a single response…      |

### [Video](/logics/video)

| Name                                                                                         | Description                                                                                                                                          |
| -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| [video:continue-watching](/logics/video#video-continue-watching)                             | Model ensemble suitable for recommending partially watched movies or episodes, or the next episode from a watched series.                            |
| [video:personal](/logics/video#video-personal)                                               | Model ensemble suitable for recommending personalized rows on the homepage or browse pages.                                                          |
| [video:segments-for-you](/logics/video#video-segments-for-you)                               | Model ensemble suitable for recommending favorite segments (genres, actors, ...) for a specific user.                                                |
| [video:popular](/logics/video#video-popular)                                                 | Model ensemble suitable for recommending globally popular items.                                                                                     |
| [video:editors-picks](/logics/video#video-editors-picks)                                     | Model ensemble suitable for recommendations of hand-picked editorial content.                                                                        |
| [video:more-like-this](/logics/video#video-more-like-this)                                   | Model ensemble suitable for recommending similar assets on the asset detail page.                                                                    |
| [video:watch-next](/logics/video#video-watch-next)                                           | Model ensemble suitable for end-of-playback recommendations embedded in a video player.                                                              |
| [video:episodes-list](/logics/video#video-episodes-list)                                     | Model ensemble suitable for reverse-chronological listing episodes of a particular series.                                                           |
| [video:search](/logics/video#video-search)                                                   | Smart personalized full-text search suitable for searching movies, series, and episodes.                                                             |
| [video:search-segments](/logics/video#video-search-segments)                                 | Smart personalized full-text search suitable for searching segments (genres, actors, ...).                                                           |
| [video:emailing](/logics/video#video-emailing)                                               | Model ensemble suitable for sending personalized emails with personalized content for the user.                                                      |
| [video:videos-from-top-genre-for-you](/logics/video#video-videos-from-top-genre-for-you)     | This Composite Logic delivers a comprehensive recommendation in a single response consisting of…                                                     |
| [video:videos-from-top-segment-for-you](/logics/video#video-videos-from-top-segment-for-you) | This Composite Logic delivers a comprehensive recommendation in a single response consisting of…                                                     |
| [video:because-you-watched](/logics/video#video-because-you-watched)                         | This Composite Logic delivers personalized recommendations based on a user's previous watching activity, all within a single response consisting of… |

### [News](/logics/news)

| Name                                                                                            | Description                                                                                                                                                              |
| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [news:daily-news](/logics/news#news-daily-news)                                                 | Model ensemble optimized for high-visibility placements.                                                                                                                 |
| [news:personal](/logics/news#news-personal)                                                     | Model ensemble providing individualized content suggestions, carefully selecting the best choices from the catalog to match each user's specific interests.              |
| [news:read-next](/logics/news#news-read-next)                                                   | Model ensemble recommending personalized articles most likely to engage users after they finish reading the current article.                                             |
| [news:trending](/logics/news#news-trending)                                                     | Model ensemble recommending news articles that are currently trending, providing users with content that is gaining widespread interest and should not be missed.        |
| [news:popular](/logics/news#news-popular)                                                       | Model ensemble recommending articles that are highly popular within a specified time period.                                                                             |
| [news:recent](/logics/news#news-recent)                                                         | Model ensemble showcasing the most recently published articles, ensuring users stay updated with the latest content.                                                     |
| [news:related](/logics/news#news-related)                                                       | Model ensemble recommending articles that are related to the current article, providing users with a seamless continuation of their reading experience on a given topic. |
| [news:categories-for-you](/logics/news#news-categories-for-you)                                 | Model ensemble recommending categories relevant to the user based on their previously read articles.                                                                     |
| [news:editors-picks](/logics/news#news-editors-picks)                                           | Model ensemble suitable for recommendations of hand-picked editorial content.                                                                                            |
| [news:emailing](/logics/news#news-emailing)                                                     | The news:emailing Logic is designed to provide a personalized selection of articles for email newsletters.                                                               |
| [news:articles-from-top-category-for-you](/logics/news#news-articles-from-top-category-for-you) | This Composite Logic provides a comprehensive recommendation in a single response consisting of…                                                                         |
| [news:articles-from-top-segment-for-you](/logics/news#news-articles-from-top-segment-for-you)   | This Composite Logic delivers personalized news article recommendations in a single response…                                                                            |
| [news:because-you-read](/logics/news#news-because-you-read)                                     | This Composite Logic delivers personalized news article recommendations based on the user's previous reading activity, all within a single response…                     |
| [news:search](/logics/news#news-search)                                                         | Smart full-text search for news articles, with configurable freshness, trendingness, and personalization sliders.                                                        |

### [Classified Advertising](/logics/classified-advertising)

| Name                                                                              | Description                                                                                                  |
| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| [classifieds:homepage](/logics/classified-advertising#classifieds-homepage)       | Model ensemble suitable for recommending products on homepage/welcome page of a Classified advertising site. |
| [classifieds:personal](/logics/classified-advertising#classifieds-personal)       | Model ensemble suitable for recommending picked ads right for the given user.                                |
| [classifieds:similar-ads](/logics/classified-advertising#classifieds-similar-ads) | Model ensemble suitable for recommending ads that are similar to the one which is currently viewed.          |