Instructions to use REST API Search service.
empathize
URL_SEARCH/INSTANCE_ID/empathize?INPUT_PARAMETERS
Parameter | Description | Data Type | Mandatory |
---|---|---|---|
q | The query for the request | String | Yes |
lang | Set the language of the query | String | Yes |
start | It is used to paginate results from a query | Integer | Yes |
rows | It is used to paginate results from a query | Integer | Yes |
It requires EB version 3.8+. Send us a request if you like to upgrade your EB instance.
Once the feature is activated, you don't need to specify any new parameter on the query. See below (section "Output - Results + topTrends") to check how the format of the response is.
NOTE: The following code is just an example, do not copy and paste this for your use
There are different outputs depending of the search results.
By default, the service will return one json node for the topTrends (more popular queries and categories for the first one).
{ topTrends: [ ] } |
{ topTrends: [ { title: "<b>sams</b>ng", title_raw: "samsung", facets: [ { facet: "rootCategories_facet" values: [ { value: "Mobile Phones", count: 5, filter: "{!tag=rootFilter}rootCategories_facet:Mobile Phones" }, { value: "Phone Accessories", count: 3, filter: "{!tag=rootFilter}rootCategories_facet:Phone Accessories" } ] } ] }, { title: "<b>sams</b>ung galaxy", title_raw: "samsung galaxy" }, { title: "tablet <b>sams</b>ung", title_raw: "tablet samsung" } ] } |