Search

Personalized search. The results are based on the search query and the preferences of a particular user.

post
Allowed on Client-Side

Personalized search. The results are based on the provided searchQuery and also on the user's past interactions (purchases, ratings, etc.) with the items (items more suitable for the user are preferred in the results).

All the string and set item properties are indexed by the search engine.

This endpoint should be used in a search box on your website/app. It can be called multiple times as the user is typing the query in order to get the most viable suggestions based on the current state of the query, or once after submitting the whole query.

The returned items are sorted by relevance (the first item being the most relevant).

Besides the recommended items, also a unique recommId is returned in the response. It can be used to:

  • Let Recombee know that this search was successful (e.g., user clicked one of the recommended items). See Reported metrics.
  • Get subsequent search results when the user scrolls down or goes to the next page. See Recommend Next Items.

It is also possible to use GET HTTP method - body parameters then become query parameters.

Copy
Initialization
const result = await client.send(new recombee.SearchItems(userId, searchQuery, count, {
  // optional parameters:
  scenario: 'search-bar',                                                // string
  cascadeCreate: true,                                                   // boolean
  returnProperties: true,                                                // boolean
  includedProperties: ['title', 'price', 'publishedAt'],                 // array
  filter: 'price > 50',                                                  // string
  booster: 'if now() - \'publishedAt\' <= 7 * 24 * 3600 then 2 else 1',  // string
  logic: 'search:personalized',                                          // string / Object
  reqlExpressions: {
    isInUsersCity: 'context_user["city"] in \'cities\'',
  },                                                                     // Object
}));

3.0.0

String
Located in: path
Required: Yes
Since version: 3.0.0

ID of your database.


String
Located in: path
Required: Yes
Since version: 3.0.0

ID of the user for whom personalized search will be performed.


String
Located in: body
Required: Yes
Since version: 3.0.0

Search query provided by the user. It is used for the full-text search.


Integer
Located in: body
Required: Yes
Since version: 3.0.0

Number of items to be returned (N for the top-N results).


String
Located in: body
Required: No
Since version: 3.0.0

Scenario defines a particular search field in your user interface.

You can set various settings to the scenario in the Admin UI. You can also see the performance of each scenario in the Admin UI separately, so you can check how well each field performs.

The AI that optimizes models to get the best results may optimize different scenarios separately, or even use different models in each of the scenarios.


Boolean
Located in: body
Required: No
Since version: 3.0.0

If the user does not exist in the database, returns a list of non-personalized search results and creates the user in the database. This allows, for example, rotations in the following recommendations for that user, as the user will be already known to the system.


Boolean
Located in: body
Required: No
Since version: 3.0.0

With returnProperties=true, property values of the recommended items are returned along with their IDs in a JSON dictionary. The acquired property values can be used to easily display the recommended items to the user.

Example response:

  {
    "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
    "recomms":
      [
        {
          "id": "tv-178",
          "values": {
            "description": "4K TV with 3D feature",
            "categories":   ["Electronics", "Televisions"],
            "price": 342,
            "url": "myshop.com/tv-178"
          }
        },
        {
          "id": "mixer-42",
          "values": {
            "description": "Stainless Steel Mixer",
            "categories":   ["Home & Kitchen"],
            "price": 39,
            "url": "myshop.com/mixer-42"
          }
        }
      ],
    "numberNextRecommsCalls": 0
  }

Array
Located in: body
Required: No
Since version: 3.0.0

Allows specifying which properties should be returned when returnProperties=true is set. The properties are given as a comma-separated list.

Example response for includedProperties=description,price:

  {
    "recommId": "a86ee8d5-cd8e-46d1-886c-8b3771d0520b",
    "recomms":
      [
        {
          "id": "tv-178",
          "values": {
            "description": "4K TV with 3D feature",
            "price": 342
          }
        },
        {
          "id": "mixer-42",
          "values": {
            "description": "Stainless Steel Mixer",
            "price": 39
          }
        }
      ],
    "numberNextRecommsCalls": 0
  }

String
Located in: body
Required: No
Since version: 2.0.0

Boolean-returning ReQL expression, which allows you to filter recommended items based on the values of their attributes.

Filters can also be assigned to a scenario in the Admin UI.


String
Located in: body
Required: No
Since version: 2.0.0

Number-returning ReQL expression, which allows you to boost the recommendation rate of some items based on the values of their attributes.

Boosters can also be assigned to a scenario in the Admin UI.


String
Object
Located in: body
Required: No
Since version: 2.4.0

Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case. See this section for a list of available logics and other details.

The difference between logic and scenario is that logic specifies mainly behavior, while scenario specifies the place where recommendations are shown to the users.

Logic can also be set to a scenario in the Admin UI.


Object
Located in: body
Required: No
Since version: 6.0.0

A dictionary of ReQL expressions that will be executed for each recommended item. This can be used to compute additional properties of the recommended items that are not stored in the database.

The keys are the names of the expressions, and the values are the actual ReQL expressions.

Example request:

{
  "reqlExpressions": {
    "isInUsersCity": "context_user[\"city\"] in 'cities'",
    "distanceToUser": "earth_distance('location', context_user[\"location\"])"
  }
}

Example response:

{
  "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
  "recomms": 
    [
      {
        "id": "restaurant-178",
        "reqlEvaluations": {
          "isInUsersCity": true,
          "distanceToUser": 5200.2
        }
      },
      {
        "id": "bar-42",
        "reqlEvaluations": {
          "isInUsersCity": false,
          "distanceToUser": 2516.0
        }
      }
    ],
   "numberNextRecommsCalls": 0
}

Successful operation.

{
  "recommId": "4fd901fe-4ba1-a3f1-a690-f4f01f76d4eb",
  "recomms": [
    {
      "id": "item-476"
    },
    {
      "id": "item-412"
    },
    {
      "id": "item-773"
    }
  ],
  "numberNextRecommsCalls": 0
}

userId does not match ^[a-zA-Z0-9_-:@.]+$, count is not a positive integer, searchQuery is not provided, filter or booster are not valid ReQL expressions, filter expression does not return boolean, booster does not return double or integer.


userId not found in the database and cascadeCreate is false. If there is no additional info in the JSON response, you probably have an error in you URL.


post
Allowed on Client-Side

Personalized search that returns Segments from a Segmentation. The results are based on the provided searchQuery and also on the user's past interactions (purchases, ratings, etc.).

Based on the used Segmentation, this endpoint can be used for example for:

  • Searching within categories or brands
  • Searching within genres or artists

For example if the user is searching for "iPhone" this endpoint can return "cell phones" category.

You need to set the used Segmentation the Admin UI in the Scenario settings prior to using this endpoint.

The returned segments are sorted by relevance (first segment being the most relevant).

It is also possible to use GET HTTP method - body parameters then become query parameters.

Copy
Initialization
const result = await client.send(new recombee.SearchItemSegments(userId, searchQuery, count, {
  // optional parameters:
  scenario: 'homepage',                                              // string
  cascadeCreate: true,                                               // boolean
  filter: '\'segmentId\' != "coupons"',                              // string
  booster: 'if \'segmentId\' == "Editors Pick" then 2 else 1',       // string
  logic: 'search:personalized',                                      // string / Object
  reqlExpressions: {
    countItems: 'size(segment_items("categories", \'segmentId\'))',
  },                                                                 // Object
}));

4.1.0

String
Located in: path
Required: Yes
Since version: 4.1.0

ID of your database.


String
Located in: path
Required: Yes
Since version: 4.1.0

ID of the user for whom personalized search will be performed.


String
Located in: body
Required: Yes
Since version: 4.1.0

Search query provided by the user. It is used for the full-text search.


Integer
Located in: body
Required: Yes
Since version: 4.1.0

Number of segments to be returned (N for the top-N results).


String
Located in: body
Required: No
Since version: 4.1.0

Scenario defines a particular application of recommendations. It can be, for example, "homepage", "cart", or "emailing".

You can set various settings to the scenario in the Admin UI. You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.

The AI that optimizes models to get the best results may optimize different scenarios separately or even use different models in each of the scenarios.


Boolean
Located in: body
Required: No
Since version: 4.1.0

If the user does not exist in the database, returns a list of non-personalized recommendations and creates the user in the database. This allows, for example, rotations in the following recommendations for that user, as the user will be already known to the system.


String
Located in: body
Required: No
Since version: 4.1.0

Boolean-returning ReQL expression which allows you to filter recommended segments based on the segmentationId.


String
Located in: body
Required: No
Since version: 4.1.0

Number-returning ReQL expression which allows you to boost recommendation rate of some segments based on the segmentationId.


String
Object
Located in: body
Required: No
Since version: 4.1.0

Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case. See this section for a list of available logics and other details.

The difference between logic and scenario is that logic specifies mainly behavior, while scenario specifies the place where recommendations are shown to the users.

Logic can also be set to a scenario in the Admin UI.


Object
Located in: body
Required: No
Since version: 6.1.0

A dictionary of ReQL expressions that will be executed for each recommended Item Segment. This can be used to compute additional properties of the recommended Item Segments.

The keys are the names of the expressions, and the values are the actual ReQL expressions.

Example request:

{
  "reqlExpressions": {
    "countItems": "size(segment_items(\"categories\", 'segmentId'))"
  }
}

Example response:

{
  "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
  "recomms": 
    [
      {
        "id": "category-fantasy-books",
        "reqlEvaluations": {
          "countItems": 486
        }
      },
      {
        "id": "category-sci-fi-costumes",
        "reqlEvaluations": {
          "countItems": 19
        }
      }
    ],
   "numberNextRecommsCalls": 0
}

successful operation

{
  "recommId": "7acdc8b5-f731-44f8-b522-72625044666f",
  "recomms": [
    {
      "id": "cell phones"
    },
    {
      "id": "cell phone accessories"
    }
  ],
  "numberNextRecommsCalls": 0
}

userId does not match ^[a-zA-Z0-9_-:@.]+$, count is not a positive integer, searchQuery is not provided, filter or booster is not valid ReQL expressions, filter expression does not return boolean, booster does not return double or integer.


userId not found in the database and cascadeCreate is false. If there is no additional info in the JSON response, you probably have an error in your URL.


Define that some words or phrases should be considered equal by the full-text search engine.

post

Adds a new synonym for the Search items.

When the term is used in the search query, the synonym is also used for the full-text search. Unless oneWay=true, it works also in the opposite way (synonym -> term).

An example of a synonym can be science fiction for the term sci-fi.

Copy
Initialization
const result = await client.send(new requests.AddSearchSynonym(term, synonym, {
  // optional parameters:
  oneWay: false,  // boolean
}));

3.2.0

1000

String
Located in: path
Required: Yes
Since version: 3.2.0

ID of your database.


String
Located in: body
Required: Yes
Since version: 3.2.0

A word to which the synonym is specified.


String
Located in: body
Required: Yes
Since version: 3.2.0

A word that should be considered equal to the term by the full-text search engine.


Boolean
Located in: body
Required: No
Since version: 3.2.0

If set to true, only term -> synonym is considered. If set to false, also synonym -> term works.

Default: false.


Successful operation. Returns data about the added synonym (including id).

{
  "id": "cc198c86-e015-bb74-b5f4-8f996fd26736",
  "term": "sci-fi",
  "synonym": "science fiction",
  "oneWay": false
}

Missing a field, or a field has a wrong type.


synonym and term pair already exists in the database. In many cases, you may consider this code a success – it only tells you that nothing has been written to the database.


get

Gives the list of synonyms defined in the database.

Copy
Initialization
const result = await client.send(new requests.ListSearchSynonyms({
  // optional parameters:
  count: 10,  // integer
  offset: 0,  // integer
}));

60

String
Located in: path
Required: Yes

ID of your database.


Integer
Located in: query
Required: No

The number of synonyms to be listed.


Integer
Located in: query
Required: No

Specifies the number of synonyms to skip (ordered by term).


Successful operation.

{
  "synonyms": [
    {
      "id": "cc198c86-e015-bb74-b5f4-8f996fd26736",
      "term": "sci-fi",
      "synonym": "science fiction",
      "oneWay": false
    },
    {
      "id": "33bef0e5-f6ee-ac04-8b80-7ba8ece1fe63",
      "term": "sitcom",
      "synonym": "situation comedy",
      "oneWay": false
    }
  ]
}

delete

Deletes all synonyms defined in the database.

Copy
Initialization
client.send(new requests.DeleteAllSearchSynonyms());

60

String
Located in: path
Required: Yes

ID of your database.


Successful operation.


delete

Deletes synonym of the given id. This synonym is no longer taken into account in the Search items.

Copy
Initialization
client.send(new requests.DeleteSearchSynonym(id));

1000

String
Located in: path
Required: Yes

ID of your database.


String
Located in: path
Required: Yes

ID of the synonym that should be deleted.


Successful operation.


Synonym with the given id does not exist.


© Copyright 2026, Recombee s.r.o
docs.recombee.com