site/opensearch/suggestions (GET)
Overview
Search the site index
- REST Method: GET
- Method Access: public
Query Parameters
Name | Type | Description |
constraint | string? | Additional search constraint (ex: language:en-us AND type:wiki) default: none |
sortby | {score, title, date, size, wordcount, rating.score, rating.count}? | Sort field. Prefix value with '-' to sort descending. default: -score |
authenticate | bool? | Force authentication for request (default: false) |
q | string | lucene search string |
Return Codes
Name | Value | Description |
OK | 200 | The request completed successfully |
Bad Request | 400 | Invalid input parameter or request body |
Message Format
Output:
Content-type=application/json
Implementation Notes
Refer here for more information about OpenSearch. Refer here for more information about OpenSearch suggestions.
C# Code Sample: Retrieve OpenSearch search suggestions
The following code example finds the OpenSearch suggestions for title "Subpage_1":
Sample Code
Plug p = Plug.New("http://deki-hayes/@api/deki"); p.At("users", "authenticate").WithCredentials("admin", "password").Get(); p.At("site", "opensearch", "suggestions").With("q", "Subpage_1").Get();
Sample Response from executing Code
["subpage_1", ["Subpage 1"]]
Curl Code Sample: Retrieve OpenSearch search suggestions
The following command returns a list of page suggestions to the query input "foo"
Sample Code
curl -u username:password -i http://mindtouch.address/@api/deki/site/opensearch/suggestions?q=foo
Sample Response from executing Code
Sample response doing a search on query "test" where 3 test pages exist:
Content-Type: application/json
["test", ["test feed", "test page 2", "test page 2"]]
Implementation notes
curl flags
- -u
- Provides external user authentication.
- -i
- Outputs the HTTP response headers. Useful for debugging.