Autocomplete API (Beta)
Autocomplete API allows you to display queries suggestions, based on the user query. This allows the user to refine its search request, with queries that yield results in the past.
Suggested queries are based on previous queries typed by users that returned results, over the last week (default time span). By default, suggestions are ordered by the number of search views.
Prerequisites to enable autocomplete
Having a working XO Search implementation
Having tracking enabled
Having XO search tracking implemented, as documented in the XO tracking plan:
Contact us to enable autocomplete.
Autocomplete
POST
https://api-eu.attraqt.io/search/autocomplete
Autocomplete the user's queries and get suggestions using the XO Search engine.
Request Body
Name | Type | Description |
---|---|---|
token* | string | XO Search token (can be found in the XO Console) |
query* | string | The query string used for the search |
options.numberOfSuggestions | integer | Number of suggestions to get, at most. Defaults to 10 (must be between 1 and 20) |
configurationId | string | Configuration to use. If unspecified, the default configuration will be used |
Example autocomplete request
Response
The search response contains two parts:
Property | Type | Description |
---|---|---|
|
| Array of suggestions. See below for the exact format |
|
| Metadata about the autocomplete request: elapsed time, ... |
suggestions
suggestions
The suggestions based on the input query
Property | Type | Description |
---|---|---|
|
| A suggestion, prefixed by the input query |
metadata
metadata
Metadata about the search query and its results.
Property | Type | Description |
---|---|---|
|
| Time the request took to complete (in milliseconds) |
|
| Search API token used for the request |
|
| Unique identifier |
|
| Search configuration id used |
Example
Last updated