Guide
Smart Search

Search as you type

2min

If you haven't gone through the prerequisites and the v2 structure, please have a look at Overview

The suggestions object is used for fetching autocomplete suggestions. This allows you to try and predict what the customer might be looking for and propose relevant search queries applicable to your catalog.

For example when the customer starts typing "a", Klevu can start making suggestions. For example it may suggest some terms starting with the letter "a" like "arris desk". It may also suggest terms not starting with "a" such as "black arris desk".

The Klevu suggestions are error tolerant, e.g. "fairry lights" would find suggestions for "fairy lights", and also order tolerant, e.g. "lights fairy" would find suggestions for "fairy lights".

This is an example to fetch instant auto complete using APIs.
POST
Request
Body Parameters
id
required
String
Every suggestion request must have a unique identifier associated with it. When a result is retrieved, the ID of each query is associated with it's respective response.
typeOfQuery
required
String
The type of suggestion query. Specify 'AUTO_SUGGESTIONS' for typeahead autosuggestion predictions.
query
required
String
The search term or phrase for which the suggestions are retrieved from Klevu Search.
hlStartElem
optional
String
By default, the section of an autosuggestion matching what the customer has typed is highlighted in bold using values of '<b>' and </b>'. If you prefer something else, you can override these values with your own HTML.
hlEndElem
optional
String
By default, the section of an autosuggestion matching what the customer has typed is highlighted in bold using values of '<b>' and </b>'. If you prefer something else, you can override these values with your own HTML.
Request Body (JSON)
PHP
JS
Java
Node.js
Responses
200


Try it here!





Updated 30 Oct 2023
Doc contributor
Doc contributor
Did this page help you?