Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Instructions to use REST API Search service.

Step-by-step guide

Service Name

empathize

Service URL

URL_SEARCH/INSTANCE_ID/empathize?INPUT_PARAMETERS

Input Parameters

ParameterDescriptionData TypeMandatory
qThe query for the requestStringYes
langSet the language of the queryStringYes
startIt is used to paginate results from a queryIntegerYes
rowsIt is used to paginate results from a queryIntegerYes


Top Trends Faceting

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.

Examples

NOTE: The following code is just an example, do not copy and paste this for your use

Output

There are different outputs depending of the search results.

TopTrends (empathize) (including categories for the most popular query)

By default, the service will return one json node for the topTrends (more popular queries and categories for the first one).

...

Code Block
languagejs
{
    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"
        }
    ]
}

Filter by label (Content by label)
cqllabel = "empathy-search-api-rest" and space = currentSpace()