Question Autocomplete is an important feature for Q&A applications. It not only saves your users from typing the complete questions, but also showcases what questions your app is capable answering. This is important because Q&A is an advanced search feature that not every user is familar with.
Miso generates autocomplete candidates from the question bank you uploaded (see Question Bank Upload API). Given a partial question string, Question Autocomplete API will suggest question candidates that match the query the user is typing.
For example, let’s first upload three questions to the question bank:
POST /v1/qa/questions
{"data": [
{"question": "What is python?"},
{"question": "What is pypy?"},
{"question": "How to sort a list in Python?"}
]}
Then, immediately after the above request finished, you can send the request below to get autocompletion candidates for any partial query string. For example, if the query string the user types so far is “what is p”:
POST /v1/qa/question_autocomplete
{
"q": "what is p",
"rows": 5
}
The API will respond the completion candidates like the following:
{
"data":
"completions": [
{"question": "What is python?"},
{"question": "What is pypy?"}
]
}
}
The API supports adaptive fuzzy matching such that even if there are typos in the query string, the API is still able to return the question candidates with the correct spellings. For example, if the query string is “How to sorta”. The API is still able to match the completion candidate: “How to sort a list in Python?”
The API is optimized for instant experience and has an average response time lower than 50ms.
Your secret API key is used to access every Miso API endpoint. You should secure this key and only use it on a backend server. Never leave this key in your client-side JavaScript code. If the private key is compromised, you can revoke it in Dojo and get a new one.
Specify your secret key in the api_key query parameter. For example:
POST /v1/users?api_key=039c501ac8dfcac91c6f05601cee876e1cc07e17