Skip to content

Commit

Permalink
[Search] Regenerate Search SDK (Azure#20977)
Browse files Browse the repository at this point in the history
* Update README and setup.py for Python 2.7 and 3.10 changes.

* Regenerate with latest Autorest.

* Search-specific updates.

* Expose generated changes.

* Reflect latest swagger updates.

* Expose kwargs via custom client.

* Update changelog.
  • Loading branch information
tjprescott authored Oct 1, 2021
1 parent 0481e9d commit 08b17d8
Show file tree
Hide file tree
Showing 33 changed files with 9,302 additions and 3,921 deletions.
11 changes: 5 additions & 6 deletions sdk/search/azure-search-documents/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release History

## 11.3.0b4 (Unreleased)
## 11.3.0b4 (2021-10-05)

### Features Added

Expand All @@ -10,19 +10,18 @@
### Breaking Changes

- Renamed `SearchClient.speller` to `SearchClient.query_speller`.
- Renamed model `Speller` to `QuerySpellerType`.
- Renamed model `Answers` to `QueryAnswerType`.
- Removed keyword arguments from `SearchClient`: `answers` and `captions`.
- `SentimentSkill`, `EntityRecognitionSkill`: added client-side validation to prevent sending unsupported parameters.

### Bugs Fixed

### Other Changes
- Renamed property `ignore_reset_requirements` to `skip_indexer_reset_requirement_for_cache`.

## 11.3.0b3 (2021-09-08)

### Features Added

- Added new models:
- `azure.search.documents.models.Captions`
- `azure.search.documents.models.QueryCaptionType`
- `azure.search.documents.models.CaptionResult`
- `azure.search.documents.indexes.models.CustomEntityLookupSkillLanguage`
- `azure.search.documents.indexes.models.EntityRecognitionSkillVersion`
Expand Down
3 changes: 3 additions & 0 deletions sdk/search/azure-search-documents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ Use the Azure.Search.Documents client library to:
[Product documentation](https://docs.microsoft.com/azure/search/search-what-is-azure-search) |
[Samples](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples)

## _Disclaimer_

_Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_

## Getting started

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from azure.core.pipeline.transport import HttpRequest

def _convert_request(request, files=None):
data = request.content if not files else None
request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
if files:
request.set_formdata_body(files)
return request

def _format_url_section(template, **kwargs):
components = template.split("/")
while components:
try:
return template.format(**kwargs)
except KeyError as key:
formatted_components = template.split("/")
components = [
c for c in formatted_components if "{}".format(key.args[0]) not in c
]
template = "/".join(components)
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from azure.core.tracing.decorator_async import distributed_trace_async

from ... import models as _models
from ..._vendor import _convert_request
from ...operations._documents_operations import build_autocomplete_get_request, build_autocomplete_post_request, build_count_request, build_get_request, build_index_request, build_search_get_request, build_search_post_request, build_suggest_get_request, build_suggest_post_request

T = TypeVar('T')
Expand Down Expand Up @@ -71,7 +72,8 @@ async def count(
request = build_count_request(
x_ms_client_request_id=_x_ms_client_request_id,
template_url=self.count.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
Expand All @@ -83,7 +85,7 @@ async def count(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('long', pipeline_response)
Expand Down Expand Up @@ -202,7 +204,8 @@ async def search_get(
semantic_fields=_semantic_fields,
x_ms_client_request_id=_x_ms_client_request_id,
template_url=self.search_get.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
Expand All @@ -214,7 +217,7 @@ async def search_get(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('SearchDocumentsResult', pipeline_response)
Expand Down Expand Up @@ -263,7 +266,8 @@ async def search_post(
x_ms_client_request_id=_x_ms_client_request_id,
json=json,
template_url=self.search_post.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
Expand All @@ -275,7 +279,7 @@ async def search_post(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('SearchDocumentsResult', pipeline_response)
Expand Down Expand Up @@ -325,7 +329,8 @@ async def get(
selected_fields=selected_fields,
x_ms_client_request_id=_x_ms_client_request_id,
template_url=self.get.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
Expand All @@ -337,7 +342,7 @@ async def get(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('object', pipeline_response)
Expand Down Expand Up @@ -419,7 +424,8 @@ async def suggest_get(
top=_top,
x_ms_client_request_id=_x_ms_client_request_id,
template_url=self.suggest_get.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
Expand All @@ -431,7 +437,7 @@ async def suggest_get(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('SuggestDocumentsResult', pipeline_response)
Expand Down Expand Up @@ -480,7 +486,8 @@ async def suggest_post(
x_ms_client_request_id=_x_ms_client_request_id,
json=json,
template_url=self.suggest_post.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
Expand All @@ -492,7 +499,7 @@ async def suggest_post(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('SuggestDocumentsResult', pipeline_response)
Expand Down Expand Up @@ -542,7 +549,8 @@ async def index(
x_ms_client_request_id=_x_ms_client_request_id,
json=json,
template_url=self.index.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
Expand All @@ -554,7 +562,7 @@ async def index(

if response.status_code not in [200, 207]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

if response.status_code == 200:
Expand Down Expand Up @@ -636,7 +644,8 @@ async def autocomplete_get(
search_fields=_search_fields,
top=_top,
template_url=self.autocomplete_get.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
Expand All @@ -648,7 +657,7 @@ async def autocomplete_get(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('AutocompleteResult', pipeline_response)
Expand Down Expand Up @@ -697,7 +706,8 @@ async def autocomplete_post(
x_ms_client_request_id=_x_ms_client_request_id,
json=json,
template_url=self.autocomplete_post.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
Expand All @@ -709,7 +719,7 @@ async def autocomplete_post(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('AutocompleteResult', pipeline_response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@
AutocompleteMode,
Captions,
IndexActionType,
QueryAnswerType,
QueryCaptionType,
QueryLanguage,
QuerySpellerType,
QueryType,
ScoringStatistics,
SearchMode,
Expand Down Expand Up @@ -89,7 +92,10 @@
'AutocompleteMode',
'Captions',
'IndexActionType',
'QueryAnswerType',
'QueryCaptionType',
'QueryLanguage',
'QuerySpellerType',
'QueryType',
'ScoringStatistics',
'SearchMode',
Expand Down
Loading

0 comments on commit 08b17d8

Please sign in to comment.