forked from jaeksoft/opensearchserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Auto completion: query
AlexandreToyer edited this page Jan 20, 2014
·
7 revisions
Use this API to request the auto-completion index
Requirement: OpenSearchServer v1.5
URL: /services/rest/index/{index_name}/autocompletion/{autocompletion_name}}?prefix={prefix}&rows{rows}
Method: GET
Header:
-
Accept (optional returned type):
application/jsonorapplication/xml
URL parameters:
- index_name (required): The name of the index.
- autocompletion_name (required): The name of the auto-completion item.
QUERY parameters:
- prefix (required): The characters used to find expressions in the auto-completion index
- rows (optional): The number of terms to return.
The auto-completion item has been populated.
HTTP code: 200
Content (application/json):
{
"successful": true,
"info": null,
"terms": [
"OpenSearchServer",
"OpenSearchServer Search",
"OpenSearchServer Search Engine",
"OpenSearchServer Search Engine API",
"OpenSearchServer OpenSearchServer",
"OpenSearchServer documentation",
"OpenSearchServer 1.3",
]
}The build failed. The reason is provided in the content.
HTTP code: 500
Using CURL:
curl -XGET http://localhost:8080/services/rest/index/my_index/autocompletion/my_expressions?prefix=open&rows=10Using jQuery:
$.ajax({
type: "GET",
dataType: "json",
url: "http://localhost:8080/services/rest/index/my_index/autocompletion/my_expressions?prefix=open&rows=10"
}).done(function (data) {
console.log(data);
});