Get Search Suggestions
To get search suggestions, send a SuggestionsRequest
. The server will respond with a SuggestionsResponse
.
URL: /api/suggestions/
Method: POST
Content-Type: application/json
Suggestions Request
Attribute | Description |
---|---|
indexes array\|null |
Array of Index names to derive search suggestions from. When null, searches all Indexes. Default null |
request string |
The search request to get suggestions for |
range number |
Maximum number of search suggestions to retrieve. Default 4 |
Suggestions Response
Attribute | Description |
---|---|
numSuggestions number |
The number of suggestions retrieved |
wordList array |
Array of Suggestion Item |
Suggestion Item
Attribute | Description |
---|---|
word string |
The suggested search word |
count number |
The total number of times the word was found across all requested Indexes. |
Example
POST
Request to /api/suggestions
Body
{
"indexes": ["Classics"]
"request": "so",
"range": 6
}
Response
{
"numSuggestions": 6,
"wordList": [
{
"word": "so",
"count": 407
},
{
"word": "soap",
"count": 2
},
{
"word": "soak",
"count": 1
},
{
"word": "soaked",
"count": 1
},
{
"word": "soaps",
"count": 1
},
{
"word": "soared",
"count": 1
}
]
}
Last update: June 21, 2020