Ask API - query suggestion
Generate query suggestions based on a partial query string.
Since 1.13.1
Syntax
const response = await client.api.ask.querySuggestion(payload, options);
Payload
The payload parameter is an object with the following properties:
| Name | Type | Description |
|---|---|---|
q |
string | Required. The search query the user has entered. Must be non-empty. |
Return value
A Promise of response object with the following properties:
| Name | Type | Description |
|---|---|---|
completions |
array of strings | An array of suggested query completions. |
Examples
const payload = {
q: '...'
};
const { completions } = await client.api.ask.querySuggestion(payload);
for (const text of completions) {
// ...
}