The purpose of this guide is to provide the steps required to integrate search service via REST API and use the returned tagging urls for each event (query, click, add2cart, ...).
URL_SEARCH/INSTANCE_ID/search?INPUT_PARAMETERS
Parameter Name | Scope | Description | Type | Mandatory | Default Value |
---|---|---|---|---|---|
q | search | The query for the request | String | ||
lang | search & tagging | Set the language used on this request | String | ||
session | search & tagging | Set the session used on this request | String | ||
user | search & tagging | Set the user used on this request | String | ||
scope | search & tagging | Set the scope used on this request | String | ||
origin | tagging | Set the origin of the request (default, GA, partials, ...) | String | ||
start | search | The number of results to omit from the start of the result set (search pagination) | Integer | 0 | |
rows | search | Number of results to return (search pagination) | Integer | 10 | |
filter | search | Set query filters to apply | String | ||
facet | search | Set query facets to return | String | ||
sort | search | Sort results | String | ||
jsonCallback | search | Name of the callback that will be executed after the request | String | ||
suggestions.suggestion.docs | search | Number of results to include for each suggestion | String |
First of all, you need to send a request with the fields that you want to use for this purpose (ie: price). Then you'll be able to use the sort param to sort the results.
The request param used for this purpose is sort and the format of the value is: field order
Note: this param can be send only one time.
Below, you can find some samples for sorting:
sort=name_sort asc |
sort=name_sort desc |
sort=price asc |
sort=price desc |
First of all, you need to send a request with the fields that you want to use for this purpose (ie: category). Then you'll be able to use the facet param to request facets.
Note: to add more facets to the query, you should simply repeat the facet parameter.
Below, you can find a sample to request a facet over brand_facet field:
facet={!ex=brand_facet}brand_facet |
...
NOTE: The following code is just an example, don't copy & paste this for your use
There are different output formats depending of the search results.
By default, the service will return two JSON nodes, one for the search results (content) and another one for the topTrends (more popular queries and categories for the first one).
Moreover this JSON includes one node per product with the tagging urls and one additional node with the search tagging url.
{ content: { numFound: 123, docs: [], facets: [], [... more fields ...] }, topTrends: [], ebTagging: { query: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/query?q=QUERY&scope=default&lang=es&totalHits=10&page=1" } } |
According to the example:
docs: [ { name: "Samsung Galaxy Note 10.1", [... more fields ...] ebTagging: { click: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/click?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4", add2cart: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/add2cart?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4", wishlist: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/wishlist?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4", conversion: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/conversion?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4" } }, { name: "Samsung SNH-1010N Smartcam", [... more fields ...] ebTagging: { click: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/click?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4", add2cart: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/add2cart?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4", wishlist: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/wishlist?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4", conversion: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/conversion?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4" } }, ] |
According to the previous example:
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" } ] |
facets: [ { facet: "brand", values: [ { value: "samsung", count: 13, filter: "brand:samsung" }, { value: "fitbit", count: 1, filter: "brand:fitbit" } ] } ] |
The search engine can detect grammatical errors and automatically correct it, for example searching by "sammsung" the system will suggest "samsung" in the spellchecked node.
{ content: { numFound: 2, docs: [], facets: [], spellchecked: "samsung" }, topTrends: [], ebTagging: { query: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/query?q=QUERY&scope=default&lang=es&totalHits=10&page=1" } } |
For example searching by "samsung panasonic" the search engine detects than there're no products with both terms but there are products with each term separately.
{ content: { suggestions: [ { suggestion: "panasonic", numFound: 101, docs: [ { name: "Panasonic KX-TG 8621", [... more fields ...] ebTagging: { click: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/click?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4", add2cart: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/add2cart?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4", wishlist: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/wishlist?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4", conversion: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/conversion?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4" } }, { name: "Panasonic KX-TGP 550", [... more fields ...] ebTagging: { click: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/click?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4", add2cart: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/add2cart?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4", wishlist: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/wishlist?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4", conversion: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/conversion?q=QUERY&scope=default&lang=es&url=PRODUCT_URL&page=1&productId=PRODUCT_ID&title=PRODUCT_NAME&type=4" } } ] }, { suggestion: "samsung", numFound: 14, docs: [ { name: "Samsung Galaxy Note 10.1", [... more fields ...] ebTagging: { ... } }, { name: "Samsung SNH-1010N Smartcam", [... more fields ...] ebTagging: { ... } } ] } ] }, topTrends: [], ebTagging: { query: "URL_EMPATHYBROKER/tagging/v1/track/CLIENT_ID/query?q=QUERY&scope=default&lang=es&totalHits=10&page=1" } } |
The suggestions node will contain one or more suggestions for each term or combination of terms contained in the query typed by the user.