Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parameters": {
"searchServiceName": "myservice",
"searchDnsSuffix": "search.windows.net",
"indexName": "myindex",
"api-version": "2017-11-11-Preview",
"autocompleteMode": "oneTerm",
"search": "washington medic",
"suggesterName": "sg",
"fuzzy": false,
"highlightPostTag": "</em>",
"highlightPreTag": "<em>",
"minimumCoverage": 80,
"searchFields": "title,description",
"top": "10"
},
"responses": {
"200": {
"body": [
{
"text": "medicaid",
"queryPlusText": "washington medicaid"
},
{
"text": "medicare",
"queryPlusText": "washington medicare"
},
{
"text": "medicine",
"queryPlusText": "washington medicine"
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"parameters": {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks the same as the GET example. That can't be right -- most of these parameters should be in the request body, no? Did this pass validation?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it does pass validation. I think the validation just checks the existence of example. In the entire spec undo this repo, I did not find an example where parameters are passed in the request body.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"searchServiceName": "myservice",
"searchDnsSuffix": "search.windows.net",
"indexName": "myindex",
"api-version": "2017-11-11-Preview",
"autocompleteRequest": {
"autocompleteMode": "oneTerm",
"search": "washington medic",
"suggesterName": "sg",
"highlightPostTag": "</em>",
"highlightPreTag": "<em>",
"minimumCoverage": 80,
"searchFields": "title,description",
"top": "10"
}
},
"responses": {
"200": {
"body": [
{
"text": "medicaid",
"queryPlusText": "washington medicaid"
},
{
"text": "medicare",
"queryPlusText": "washington medicare"
},
{
"text": "medicine",
"queryPlusText": "washington medicine"
}
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,162 @@
}
}
}
},
"/docs/autocomplete": {
"get": {
"tags": [
"Autocomplete"
],
"operationId": "DocumentsProxy_AutocompleteGet",
"x-ms-examples": {
"SearchIndexGetAutocomplete": { "$ref": "./examples/SearchIndexGetAutocomplete.json" }
},
"description": "Autocompletes incomplete query terms based on input text and matching terms in the Azure Search index.",
"parameters": [
{
"$ref": "#/parameters/ClientRequestIdParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"name": "autocompleteMode",
"in": "query",
"required": true,
"type": "string",
"enum": [
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already an AutocompleteMode enum definition later in the file. Can this parameter definition refer to that type instead of re-defining it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that. Doing so somehow makes AutocompleteMode a generic object type.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too bad. Doing it this way still results in only one generated AutocompleteMode enum though, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

"oneTerm",
"twoTerms",
"oneTermWithContext"
],
"x-ms-enum": {
"name": "AutocompleteMode",
"modelAsString": false
},
"description": "Autocomplete mode."
},
{
"name":"search",
"in": "query",
"type": "string",
"description": "The incomplete term which should be auto-completed."
},
{
"name":"suggesterName",
"in": "query",
"type": "string",
"description": "The name of the suggester as specified in the suggesters collection that's part of the index definition."
},
{
"name":"fuzzy",
"in": "query",
"type": "boolean",
"description": "A value indicating whether to use fuzzy matching for the autocomplete query. Default is false. When set to true, the query will find terms even if there's a substituted or missing character in the search text. While this provides a better experience in some scenarios it comes at a performance cost as fuzzy autocomplete queries are slower and consume more resources.",
"x-ms-parameter-grouping": {
"name": "AutocompleteParameters"
}
},
{
"name":"highlightPostTag",
"in": "query",
"type": "string",
"description": "A string tag that is appended to hit highlights. Must be set with HighlightPreTag. If omitted, hit highlighting is disabled.",
"x-ms-parameter-grouping": {
"name": "AutocompleteParameters"
}
},
{
"name":"highlightPreTag",
"in": "query",
"type": "string",
"description": "A string tag that is prepended to hit highlights. Must be set with HighlightPostTag. If omitted, hit highlighting is disabled.",
"x-ms-parameter-grouping": {
"name": "AutocompleteParameters"
}
},
{
"name":"minimumCoverage",
"in": "query",
"type": "number",
"format": "double",
"description": "A number between 0 and 100 indicating the percentage of the index that must be covered by am autocomplete query in order for the query to be reported as a success. This parameter can be useful for ensuring search availability even for services with only one replica. The default is 80.",
"x-ms-parameter-grouping": {
"name": "AutocompleteParameters"
}
},
{
"name":"searchFields",
"in": "query",
"type": "array",
"items": {
"type": "string"
},
"description": "The comma-separated list of field names to consider when querying for auto-completed terms.",
"x-ms-parameter-grouping": {
"name": "AutocompleteParameters"
}
},
{
"name":"$top",
"in": "query",
"type": "integer",
"format": "int32",
"description": "The number of auto-completed terms to retrieve. This must be a value between 1 and 100. The default is to 5.",
"x-ms-parameter-grouping": {
"name": "AutocompleteParameters"
}
}
],
"x-ms-request-id": "request-id",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/AutocompleteResult",
"description": "The result of Autocomplete query."
}
}
}
},
"post": {
"tags": [
"Autocomplete"
],
"operationId": "DocumentsProxy_AutocompletePost",
"x-ms-examples": {
"SearchIndexPostAutocomplete": { "$ref": "./examples/SearchIndexPostAutocomplete.json" }
},
"description": "Autocompletes incomplete query terms based on input text and matching terms in the Azure Search index.",
"parameters": [
{
"$ref": "#/parameters/ClientRequestIdParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"name": "AutocompleteRequest",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/AutocompleteRequest",
"description": "The Autocomplete request."
},
"description": "The definition of the Autocomplete request."
}
],
"x-ms-request-id": "request-id",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/AutocompleteResult",
"description": "The result of Autocomplete query."
}
}
}
}

}
},
"definitions": {
Expand Down Expand Up @@ -138,6 +294,17 @@
"x-ms-enum": { "name": "QueryType" },
"description": "Specifies the syntax of the search query. The default is 'simple'. Use 'full' if your query uses the Lucene query syntax."
},
"AutocompleteMode": {
"type": "string",
"enum": [
"oneTerm",
"twoTerms",
"oneTermWithContext"
],
"x-ms-enum": { "name": "AutocompleteMode",
"modelAsString" : false },
"description": "Specifies the mode for Autocomplete. The default is 'oneTerm'. Use 'twoTerms' to get shingles and 'oneTermWithContext' to use the current context in producing autocomplete terms."
},
"SearchParametersPayload": {
"properties": {
"count": {
Expand Down Expand Up @@ -287,6 +454,76 @@
}
},
"description": "Parameters for filtering, sorting, fuzzy matching, and other suggestions query behaviors."
},
"AutocompleteRequest": {
"properties": {
"autocompleteMode": {
"$ref": "#/definitions/AutocompleteMode",
"description": "Specifies the mode for Autocomplete. The default is 'oneTerm'. Use 'twoTerms' to get shingles and 'oneTermWithContext' to use the current context while producing auto-completed terms."
},
"fuzzy": {
"type": "boolean",
"description": "A value indicating whether to use fuzzy matching for the autocomplete query. Default is false. when set to true, the query will autocomplete terms even if there's a substituted or missing character in the search text. While this provides a better experience in some scenarios it comes at a performance cost as fuzzy autocomplete queries are slower and consume more resources."
},
"highlightPostTag": {
"type": "string",
"description": "A string tag that is appended to hit highlights. Must be set with HighlightPreTag. If omitted, hit highlighting is disabled."
},
"highlightPreTag": {
"type": "string",
"description": "A string tag that is prepended to hit highlights. Must be set with HighlightPostTag. If omitted, hit highlighting is disabled."
},
"minimumCoverage": {
"type": "number",
"format": "double",
"description": "A number between 0 and 100 indicating the percentage of the index that must be covered by am autocomplete query in order for the query to be reported as a success. This parameter can be useful for ensuring search availability even for services with only one replica. The default is 80."
},
"search": {
"type": "string",
"description": "The search text on which to base autocomplete results."
},
"searchFields": {
"type": "string",
"description": "The comma-separated list of field names to consider when querying for auto-completed terms."
},
"suggesterName": {
"type": "string",
"description": "The name of the suggester as specified in the suggesters collection that's part of the index definition."
},
"top": {
"type": "integer",
"format": "int32",
"description": "The number of auto-completed terms to retrieve. This must be a value between 1 and 100. The default is to 5."
}
},
"description": "Parameters for fuzzy matching, and other autocomplete query behaviors."
},
"AutocompleteResult" : {
"properties": {
"value": {
"type": "array",
"readOnly": true,
"items": {
"$ref": "#/definitions/AutocompleteItem"
},
"description": "The list of returned Autocompleted items.",
"x-ms-client-name": "Results"
}
},
"description": "The result of Autocomlete query."
},
"AutocompleteItem": {
"properties": {
"text": {
"type": "string",
"description": "The completed term."
},
"queryPlusText": {
"type": "string",
"description": "The query along with the completed term."
}
},
"description": "The result of Autocomplete requests."
}
},
"parameters": {
Expand Down