-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[Azure Search] Add autocomplete to data plane spec for 2017-11-11-Preview #3106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
88b76be
4d3caa7
f73a316
5dafab8
c43fbf6
fb54f3b
914d8ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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": { | ||
| "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 |
|---|---|---|
|
|
@@ -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": [ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is already an
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried that. Doing so somehow makes AutocompleteMode a generic
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Too bad. Doing it this way still results in only one generated
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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": { | ||
|
|
@@ -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": { | ||
|
|
@@ -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": { | ||
|
|
||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's one: https://github.com/Azure/azure-rest-api-specs/blob/master/specification/search/data-plane/Microsoft.Azure.Search.Service/preview/2017-11-11-preview/examples/SearchServiceCreateIndex.json