Instructions to use REST API Search service.
|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|
|topTrends.rows||Specify a number of rows for the topTrends section. If this parameter is not specified, the rows param will be used||Integer||No|
|filter||Set query filters||String||No|
|facet||Set query facets||String||No|
|jsonCallback||Name of the callback that will be executed after the request||String||No|
|suggestions.suggestion.docs||Number of results to include for each suggestion||String||No|
|equalize||Custom equalize to apply it instead of the active equalize.||String||No|
Send us a request with the fields you want to use for SORTING and we will configure it.
You can find below some code samples of the api syntax for sorting.
price min to max
price max to min
Send us a request with the list of fields that you want to use for FACETING and we will add it to the config.
Example of the api syntax for faceting, with the field brand_facet:
To add more facets to the query, you should simply repeat the facet parameter.
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.
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.
Results + topTrends (empathize) (including categories for the most popular query)
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).
According to the previous example:
- numFound → number of the documents returned by the service
- docs → Json array with the documents returned by the service. Each one will contain all the fields configured to be returned by the search service.
- facets → filters, will contain one entry for each facet contained in the request using the facets param or directly configured in the search service by the EB Team.
- topTrends → Popular trends, including category facet for the first one.
Spellcheck + topTrends (empathize)
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.
Suggestions + topTrends (empathize)
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.
The suggestions node will contain one or more suggestions for each term or combination of terms contained in the query typed by the user.
- suggestion → term suggested by the search engine
- numFound → number of results that the search engine will return searching using this suggestion
- docs → By default, the search engine will return a sample of the results using this suggestion