Warning

This site is no longer being maintained. Visit the eDocs documentation portal for updated information.

Visit eDocs
Dismiss message

Query Context

Created by Pedro Ondiviela · last update June 5, 2020

What is this about?

Returns the top product attributes and the top specific products for a specific query. Both the attributes and specific products weights are calculated based on user clicks, add-to-carts and purchases and the values are normalized using a linear function.

About this Endpoint

Structure for calling the endpoint.

Request URL example

GET https://api.empathybroker.com/contextsearch/v2/querycontext/all/{instance_id}?{Input_parameters}

Input Parameters

Parameter name Data Type
Required:  
query String
lang String
Not required:  
attributes.row Integer
products.rows Integer
events.min Integer
userAttributes String
maxTries Integer


Responses

Responses examples for successful and failing calls to the endpoint.

topAttributes” objects don’t have a fixed order and it may change in between requests. Nevertheless, values for each attribute are sorted by “weight” in descending order.

topProducts” are sorted by “weight” in descending order.

200 400 404

Successful request

Type: application/json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
  "topAttributes": [
    {
      "field": "brand",
      "values": [
        {"value": "brand1", "weight": 3},
        {"value": "brand2", "weight": 1.8}
      ]
    },
    {
      "field": "category",
      "values": [
        {"value": "mobiles", "weight": 3}
      ]
    }
  ],
  "topProducts": [
    {"value":"213115", weight:"3"},
    {"value":"213149", weight:"1.3"}
  ]
}