From 24fcd7111034f9c66f4dc21dcee5043f23aec96a Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Wed, 11 Feb 2026 11:49:38 -0800 Subject: [PATCH 1/8] patch list index --- .../azure-search-documents/_metadata.json | 5 +- .../apiview-properties.json | 5 +- .../azure/search/documents/_client.py | 6 +- .../azure/search/documents/_configuration.py | 6 +- .../azure/search/documents/aio/_client.py | 6 +- .../search/documents/aio/_configuration.py | 6 +- .../azure/search/documents/indexes/_client.py | 12 +- .../documents/indexes/_configuration.py | 12 +- .../indexes/_operations/_operations.py | 124 +++++++++++- .../documents/indexes/_operations/_patch.py | 21 ++- .../search/documents/indexes/aio/_client.py | 12 +- .../documents/indexes/aio/_configuration.py | 12 +- .../indexes/aio/_operations/_operations.py | 102 +++++++++- .../indexes/aio/_operations/_patch.py | 21 ++- .../documents/indexes/models/__init__.py | 2 + .../documents/indexes/models/_models.py | 176 ++++++++++++++++++ .../documents/knowledgebases/_client.py | 6 +- .../knowledgebases/_configuration.py | 6 +- .../documents/knowledgebases/aio/_client.py | 6 +- .../knowledgebases/aio/_configuration.py | 6 +- .../azure/search/documents/models/_patch.py | 1 + 21 files changed, 486 insertions(+), 67 deletions(-) diff --git a/sdk/search/azure-search-documents/_metadata.json b/sdk/search/azure-search-documents/_metadata.json index 66892d1cb69d..26bd40e914cd 100644 --- a/sdk/search/azure-search-documents/_metadata.json +++ b/sdk/search/azure-search-documents/_metadata.json @@ -1,3 +1,6 @@ { - "apiVersion": "2025-11-01-preview" + "apiVersion": "2025-11-01-preview", + "apiVersions": { + "Search": "2025-11-01-preview" + } } \ No newline at end of file diff --git a/sdk/search/azure-search-documents/apiview-properties.json b/sdk/search/azure-search-documents/apiview-properties.json index f26cb866984b..89a70bf4d99a 100644 --- a/sdk/search/azure-search-documents/apiview-properties.json +++ b/sdk/search/azure-search-documents/apiview-properties.json @@ -226,6 +226,7 @@ "azure.search.documents.indexes.models.SearchIndexKnowledgeSource": "Search.SearchIndexKnowledgeSource", "azure.search.documents.indexes.models.SearchIndexKnowledgeSourceParameters": "Search.SearchIndexKnowledgeSourceParameters", "azure.search.documents.knowledgebases.models.SearchIndexKnowledgeSourceParams": "Search.SearchIndexKnowledgeSourceParams", + "azure.search.documents.indexes.models.SearchIndexResponse": "Search.SearchIndexResponse", "azure.search.documents.models.SearchRequest": "Search.SearchRequest", "azure.search.documents.indexes.models.SearchResourceEncryptionKey": "Search.SearchResourceEncryptionKey", "azure.search.documents.models.SearchResult": "Search.SearchResult", @@ -396,8 +397,8 @@ "azure.search.documents.aio.SearchIndexClient.create_synonym_map": "Customizations.SearchIndexClient.SynonymMaps.create", "azure.search.documents.SearchIndexClient.get_index": "Customizations.SearchIndexClient.Indexes.get", "azure.search.documents.aio.SearchIndexClient.get_index": "Customizations.SearchIndexClient.Indexes.get", - "azure.search.documents.SearchIndexClient.list_indexes": "Customizations.SearchIndexClient.Indexes.list", - "azure.search.documents.aio.SearchIndexClient.list_indexes": "Customizations.SearchIndexClient.Indexes.list", + "azure.search.documents.SearchIndexClient.list_indexes_with_selected_properties": "Customizations.SearchIndexClient.Indexes.listWithSelectedProperties", + "azure.search.documents.aio.SearchIndexClient.list_indexes_with_selected_properties": "Customizations.SearchIndexClient.Indexes.listWithSelectedProperties", "azure.search.documents.SearchIndexClient.create_index": "Customizations.SearchIndexClient.Indexes.create", "azure.search.documents.aio.SearchIndexClient.create_index": "Customizations.SearchIndexClient.Indexes.create", "azure.search.documents.SearchIndexClient.get_alias": "Customizations.SearchIndexClient.Aliases.get", diff --git a/sdk/search/azure-search-documents/azure/search/documents/_client.py b/sdk/search/azure-search-documents/azure/search/documents/_client.py index 5f688aa13b44..f96d7ea85bb4 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_client.py @@ -34,9 +34,9 @@ class SearchClient(_SearchClientOperationsMixin): ~azure.core.credentials.TokenCredential :param index_name: The name of the index. Required. :type index_name: str - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/_configuration.py index f6f346ca1211..dfe36d2d3450 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_configuration.py @@ -31,9 +31,9 @@ class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes ~azure.core.credentials.TokenCredential :param index_name: The name of the index. Required. :type index_name: str - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/aio/_client.py b/sdk/search/azure-search-documents/azure/search/documents/aio/_client.py index 5634eb8a97d5..e2aa4dc24ac6 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/aio/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/aio/_client.py @@ -34,9 +34,9 @@ class SearchClient(_SearchClientOperationsMixin): ~azure.core.credentials_async.AsyncTokenCredential :param index_name: The name of the index. Required. :type index_name: str - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/aio/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/aio/_configuration.py index 34ad0564cab6..5063e52eb2c9 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/aio/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/aio/_configuration.py @@ -31,9 +31,9 @@ class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes ~azure.core.credentials_async.AsyncTokenCredential :param index_name: The name of the index. Required. :type index_name: str - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_client.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_client.py index 54c2e85631d1..4a3b1a14824f 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_client.py @@ -32,9 +32,9 @@ class SearchIndexClient(_SearchIndexClientOperationsMixin): credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ @@ -111,9 +111,9 @@ class SearchIndexerClient(_SearchIndexerClientOperationsMixin): credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_configuration.py index a1c66e4d109e..ccbce6e25376 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_configuration.py @@ -29,9 +29,9 @@ class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attri credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ @@ -84,9 +84,9 @@ class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-att credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py index fe1ec10a1fb3..af167b448c85 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py @@ -286,7 +286,28 @@ def build_search_index_get_index_request(name: str, **kwargs: Any) -> HttpReques return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_search_index_list_indexes_request(*, select: Optional[list[str]] = None, **kwargs: Any) -> HttpRequest: +def build_search_index_list_indexes_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") + + # Construct URL + _url = "/indexes" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_search_index_list_indexes_with_selected_properties_request( # pylint: disable=name-too-long + *, select: Optional[list[str]] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2210,13 +2231,9 @@ def get_index(self, name: str, **kwargs: Any) -> _models1.SearchIndex: return deserialized # type: ignore @distributed_trace - def list_indexes(self, *, select: Optional[list[str]] = None, **kwargs: Any) -> ItemPaged["_models1.SearchIndex"]: + def _list_indexes(self, **kwargs: Any) -> ItemPaged["_models1.SearchIndex"]: """Lists all indexes available for a search service. - :keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated - list of JSON property names, or '*' for all properties. The default is all properties. Default - value is None. - :paramtype select: list[str] :return: An iterator like instance of SearchIndex :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndex] :raises ~azure.core.exceptions.HttpResponseError: @@ -2238,7 +2255,6 @@ def prepare_request(next_link=None): if not next_link: _request = build_search_index_list_indexes_request( - select=select, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2300,6 +2316,100 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + @distributed_trace + def list_indexes_with_selected_properties( + self, *, select: Optional[list[str]] = None, **kwargs: Any + ) -> ItemPaged["_models1.SearchIndexResponse"]: + """Lists all indexes available for a search service. + + :keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated + list of JSON property names, or '*' for all properties. The default is all properties. Default + value is None. + :paramtype select: list[str] + :return: An iterator like instance of SearchIndexResponse + :rtype: + ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndexResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_models1.SearchIndexResponse]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_search_index_list_indexes_with_selected_properties_request( + select=select, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(list[_models1.SearchIndexResponse], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models2.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + @overload def create_index( self, index: _models1.SearchIndex, *, content_type: str = "application/json", **kwargs: Any diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py index d721de4dbe5b..1c8775441415 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py @@ -325,6 +325,25 @@ def delete_knowledge_source( **kwargs, ) + @distributed_trace + def list_indexes( + self, *, select: Optional[List[str]] = None, **kwargs: Any + ) -> ItemPaged[Union[_models.SearchIndex, _models.SearchIndexResponse]]: + """Lists all indexes available for a search service. + + :keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated + list of JSON property names, or '*' for all properties. The default is all properties. If + select is provided, uses the list_indexes_with_selected_properties endpoint which returns + SearchIndexResponse objects. Default value is None. + :paramtype select: list[str] + :return: An iterator like instance of SearchIndex or SearchIndexResponse + :rtype: ~azure.core.paging.ItemPaged[Union[~azure.search.documents.indexes.models.SearchIndex, ~azure.search.documents.indexes.models.SearchIndexResponse]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + if select is not None: + return self.list_indexes_with_selected_properties(select=select, **kwargs) + return self._list_indexes(**kwargs) + @distributed_trace def list_index_names(self, **kwargs: Any) -> ItemPaged[str]: """Lists the names of all indexes available for a search service. @@ -333,7 +352,7 @@ def list_index_names(self, **kwargs: Any) -> ItemPaged[str]: :rtype: ~azure.core.paging.ItemPaged[str] :raises ~azure.core.exceptions.HttpResponseError: """ - names = self.list_indexes(cls=lambda objs: [x.name for x in objs], **kwargs) + names = self._list_indexes(cls=lambda objs: [x.name for x in objs], **kwargs) return cast(ItemPaged[str], names) @distributed_trace diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_client.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_client.py index 8827716ecdcf..abfade0135cc 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_client.py @@ -32,9 +32,9 @@ class SearchIndexClient(_SearchIndexClientOperationsMixin): credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ @@ -115,9 +115,9 @@ class SearchIndexerClient(_SearchIndexerClientOperationsMixin): credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_configuration.py index c50be6dff29a..ecf97247abc0 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_configuration.py @@ -29,9 +29,9 @@ class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attri credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ @@ -86,9 +86,9 @@ class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-att credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py index 94160d3a5405..6056861f47d8 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py @@ -65,6 +65,7 @@ build_search_index_list_aliases_request, build_search_index_list_index_stats_summary_request, build_search_index_list_indexes_request, + build_search_index_list_indexes_with_selected_properties_request, build_search_index_list_knowledge_bases_request, build_search_index_list_knowledge_sources_request, build_search_indexer_create_data_source_connection_request, @@ -838,24 +839,111 @@ async def get_index(self, name: str, **kwargs: Any) -> _models2.SearchIndex: return deserialized # type: ignore @distributed_trace - def list_indexes( + def _list_indexes(self, **kwargs: Any) -> AsyncItemPaged["_models2.SearchIndex"]: + """Lists all indexes available for a search service. + + :return: An iterator like instance of SearchIndex + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchIndex] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_models2.SearchIndex]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_search_index_list_indexes_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(list[_models2.SearchIndex], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models3.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_indexes_with_selected_properties( self, *, select: Optional[list[str]] = None, **kwargs: Any - ) -> AsyncItemPaged["_models2.SearchIndex"]: + ) -> AsyncItemPaged["_models2.SearchIndexResponse"]: """Lists all indexes available for a search service. :keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated list of JSON property names, or '*' for all properties. The default is all properties. Default value is None. :paramtype select: list[str] - :return: An iterator like instance of SearchIndex + :return: An iterator like instance of SearchIndexResponse :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchIndex] + ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchIndexResponse] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[list[_models2.SearchIndex]] = kwargs.pop("cls", None) + cls: ClsType[list[_models2.SearchIndexResponse]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -868,7 +956,7 @@ def list_indexes( def prepare_request(next_link=None): if not next_link: - _request = build_search_index_list_indexes_request( + _request = build_search_index_list_indexes_with_selected_properties_request( select=select, api_version=self._config.api_version, headers=_headers, @@ -905,7 +993,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models2.SearchIndex], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models2.SearchIndexResponse], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py index 1a698a3a7a36..b86728d894f5 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py @@ -336,6 +336,25 @@ async def delete_knowledge_source( **kwargs, ) + @distributed_trace + def list_indexes( + self, *, select: Optional[List[str]] = None, **kwargs: Any + ) -> AsyncItemPaged[Union[_models.SearchIndex, _models.SearchIndexResponse]]: + """Lists all indexes available for a search service. + + :keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated + list of JSON property names, or '*' for all properties. The default is all properties. If + select is provided, uses the list_indexes_with_selected_properties endpoint which returns + SearchIndexResponse objects. Default value is None. + :paramtype select: list[str] + :return: An async iterator like instance of SearchIndex or SearchIndexResponse + :rtype: ~azure.core.async_paging.AsyncItemPaged[Union[~azure.search.documents.indexes.models.SearchIndex, ~azure.search.documents.indexes.models.SearchIndexResponse]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + if select is not None: + return self.list_indexes_with_selected_properties(select=select, **kwargs) + return self._list_indexes(**kwargs) + @distributed_trace def list_index_names(self, **kwargs: Any) -> AsyncItemPaged[str]: """Lists the names of all indexes available for a search service. @@ -344,7 +363,7 @@ def list_index_names(self, **kwargs: Any) -> AsyncItemPaged[str]: :rtype: ~azure.core.async_paging.AsyncItemPaged[str] :raises ~azure.core.exceptions.HttpResponseError: """ - names = self.list_indexes(cls=lambda objs: [x.name for x in objs], **kwargs) + names = self._list_indexes(cls=lambda objs: [x.name for x in objs], **kwargs) return cast(AsyncItemPaged[str], names) @distributed_trace_async diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py index bebb2d41130c..7809bb21937c 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py @@ -150,6 +150,7 @@ SearchIndexFieldReference, SearchIndexKnowledgeSource, SearchIndexKnowledgeSourceParameters, + SearchIndexResponse, SearchIndexer, SearchIndexerCache, SearchIndexerDataContainer, @@ -440,6 +441,7 @@ "SearchIndexFieldReference", "SearchIndexKnowledgeSource", "SearchIndexKnowledgeSourceParameters", + "SearchIndexResponse", "SearchIndexer", "SearchIndexerCache", "SearchIndexerDataContainer", diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py index fb205c60d3f1..bcfd8a516667 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py @@ -9617,6 +9617,182 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class SearchIndexResponse(_Model): + """Represents a search index definition, which describes the fields and search behavior of an + index. + + :ivar name: The name of the index. Required. + :vartype name: str + :ivar description: The description of the index. + :vartype description: str + :ivar fields: The fields of the index. + :vartype fields: list[~azure.search.documents.indexes.models.SearchField] + :ivar scoring_profiles: The scoring profiles for the index. + :vartype scoring_profiles: list[~azure.search.documents.indexes.models.ScoringProfile] + :ivar default_scoring_profile: The name of the scoring profile to use if none is specified in + the query. If this property is not set and no scoring profile is specified in the query, then + default scoring (tf-idf) will be used. + :vartype default_scoring_profile: str + :ivar cors_options: Options to control Cross-Origin Resource Sharing (CORS) for the index. + :vartype cors_options: ~azure.search.documents.indexes.models.CorsOptions + :ivar suggesters: The suggesters for the index. + :vartype suggesters: list[~azure.search.documents.indexes.models.SearchSuggester] + :ivar analyzers: The analyzers for the index. + :vartype analyzers: list[~azure.search.documents.indexes.models.LexicalAnalyzer] + :ivar tokenizers: The tokenizers for the index. + :vartype tokenizers: list[~azure.search.documents.indexes.models.LexicalTokenizer] + :ivar token_filters: The token filters for the index. + :vartype token_filters: list[~azure.search.documents.indexes.models.TokenFilter] + :ivar char_filters: The character filters for the index. + :vartype char_filters: list[~azure.search.documents.indexes.models.CharFilter] + :ivar normalizers: The normalizers for the index. + :vartype normalizers: list[~azure.search.documents.indexes.models.LexicalNormalizer] + :ivar encryption_key: A description of an encryption key that you create in Azure Key Vault. + This key is used to provide an additional level of encryption-at-rest for your data when you + want full assurance that no one, not even Microsoft, can decrypt your data. Once you have + encrypted your data, it will always remain encrypted. The search service will ignore attempts + to set this property to null. You can change this property as needed if you want to rotate your + encryption key; Your data will be unaffected. Encryption with customer-managed keys is not + available for free search services, and is only available for paid services created on or after + January 1, 2019. + :vartype encryption_key: ~azure.search.documents.indexes.models.SearchResourceEncryptionKey + :ivar similarity: The type of similarity algorithm to be used when scoring and ranking the + documents matching a search query. The similarity algorithm can only be defined at index + creation time and cannot be modified on existing indexes. If null, the ClassicSimilarity + algorithm is used. + :vartype similarity: ~azure.search.documents.indexes.models.SimilarityAlgorithm + :ivar semantic: Defines parameters for a search index that influence semantic capabilities. + :vartype semantic: ~azure.search.documents.indexes.models.SemanticSearch + :ivar vector_search: Contains configuration options related to vector search. + :vartype vector_search: ~azure.search.documents.indexes.models.VectorSearch + :ivar permission_filter_option: A value indicating whether permission filtering is enabled for + the index. Known values are: "enabled" and "disabled". + :vartype permission_filter_option: str or + ~azure.search.documents.indexes.models.SearchIndexPermissionFilterOption + :ivar purview_enabled: A value indicating whether Purview is enabled for the index. + :vartype purview_enabled: bool + :ivar e_tag: The ETag of the index. + :vartype e_tag: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the index. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of the index.""" + fields: Optional[list["_models.SearchField"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The fields of the index.""" + scoring_profiles: Optional[list["_models.ScoringProfile"]] = rest_field( + name="scoringProfiles", visibility=["read", "create", "update", "delete", "query"] + ) + """The scoring profiles for the index.""" + default_scoring_profile: Optional[str] = rest_field( + name="defaultScoringProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the scoring profile to use if none is specified in the query. If this property is + not set and no scoring profile is specified in the query, then default scoring (tf-idf) will be + used.""" + cors_options: Optional["_models.CorsOptions"] = rest_field( + name="corsOptions", visibility=["read", "create", "update", "delete", "query"] + ) + """Options to control Cross-Origin Resource Sharing (CORS) for the index.""" + suggesters: Optional[list["_models.SearchSuggester"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The suggesters for the index.""" + analyzers: Optional[list["_models.LexicalAnalyzer"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The analyzers for the index.""" + tokenizers: Optional[list["_models.LexicalTokenizer"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The tokenizers for the index.""" + token_filters: Optional[list["_models.TokenFilter"]] = rest_field( + name="tokenFilters", visibility=["read", "create", "update", "delete", "query"] + ) + """The token filters for the index.""" + char_filters: Optional[list["_models.CharFilter"]] = rest_field( + name="charFilters", visibility=["read", "create", "update", "delete", "query"] + ) + """The character filters for the index.""" + normalizers: Optional[list["_models.LexicalNormalizer"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The normalizers for the index.""" + encryption_key: Optional["_models.SearchResourceEncryptionKey"] = rest_field( + name="encryptionKey", visibility=["read", "create", "update", "delete", "query"] + ) + """A description of an encryption key that you create in Azure Key Vault. This key is used to + provide an additional level of encryption-at-rest for your data when you want full assurance + that no one, not even Microsoft, can decrypt your data. Once you have encrypted your data, it + will always remain encrypted. The search service will ignore attempts to set this property to + null. You can change this property as needed if you want to rotate your encryption key; Your + data will be unaffected. Encryption with customer-managed keys is not available for free search + services, and is only available for paid services created on or after January 1, 2019.""" + similarity: Optional["_models.SimilarityAlgorithm"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of similarity algorithm to be used when scoring and ranking the documents matching a + search query. The similarity algorithm can only be defined at index creation time and cannot be + modified on existing indexes. If null, the ClassicSimilarity algorithm is used.""" + semantic: Optional["_models.SemanticSearch"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Defines parameters for a search index that influence semantic capabilities.""" + vector_search: Optional["_models.VectorSearch"] = rest_field( + name="vectorSearch", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains configuration options related to vector search.""" + permission_filter_option: Optional[Union[str, "_models.SearchIndexPermissionFilterOption"]] = rest_field( + name="permissionFilterOption", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether permission filtering is enabled for the index. Known values are: + \"enabled\" and \"disabled\".""" + purview_enabled: Optional[bool] = rest_field( + name="purviewEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether Purview is enabled for the index.""" + e_tag: Optional[str] = rest_field(name="@odata.etag", visibility=["read", "create", "update", "delete", "query"]) + """The ETag of the index.""" + + @overload + def __init__( + self, + *, + name: str, + description: Optional[str] = None, + fields: Optional[list["_models.SearchField"]] = None, + scoring_profiles: Optional[list["_models.ScoringProfile"]] = None, + default_scoring_profile: Optional[str] = None, + cors_options: Optional["_models.CorsOptions"] = None, + suggesters: Optional[list["_models.SearchSuggester"]] = None, + analyzers: Optional[list["_models.LexicalAnalyzer"]] = None, + tokenizers: Optional[list["_models.LexicalTokenizer"]] = None, + token_filters: Optional[list["_models.TokenFilter"]] = None, + char_filters: Optional[list["_models.CharFilter"]] = None, + normalizers: Optional[list["_models.LexicalNormalizer"]] = None, + encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, + similarity: Optional["_models.SimilarityAlgorithm"] = None, + semantic: Optional["_models.SemanticSearch"] = None, + vector_search: Optional["_models.VectorSearch"] = None, + permission_filter_option: Optional[Union[str, "_models.SearchIndexPermissionFilterOption"]] = None, + purview_enabled: Optional[bool] = None, + e_tag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class SearchResourceEncryptionKey(_Model): """A customer-managed encryption key in Azure Key Vault. Keys that you create and manage can be used to encrypt or decrypt data-at-rest, such as indexes and synonym maps. diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_client.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_client.py index fcb1e21616ec..dc6edd562aa6 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_client.py @@ -32,9 +32,9 @@ class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClientOperationsMixin) credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_configuration.py index 425408a1c073..f7ab40eddeb8 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_configuration.py @@ -29,9 +29,9 @@ class KnowledgeBaseRetrievalClientConfiguration: # pylint: disable=too-many-ins credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_client.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_client.py index 0bbbb8cd4366..3e7834244a6a 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_client.py @@ -32,9 +32,9 @@ class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClientOperationsMixin) credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_configuration.py index ec28807286a4..81dada9e9ccb 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_configuration.py @@ -29,9 +29,9 @@ class KnowledgeBaseRetrievalClientConfiguration: # pylint: disable=too-many-ins credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/models/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/models/_patch.py index 01d2a43fad0f..1a047214579e 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/models/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/models/_patch.py @@ -18,6 +18,7 @@ # Backward-compatible alias: IS was renamed to IS_ENUM to avoid conflict with Python keyword ScoringStatistics.Global = ScoringStatistics.GLOBAL_ENUM # type: ignore[attr-defined] + def _flatten_args(args: Tuple[Union[List[Dict[Any, Any]], List[List[Dict[Any, Any]]]], ...]) -> List[Dict]: """Flatten variadic arguments into a single list of documents. From 9a1c79bba94a014bb09a37083f7b2961a0862317 Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Wed, 11 Feb 2026 12:46:50 -0800 Subject: [PATCH 2/8] fix mypy --- .../search/documents/indexes/_operations/_patch.py | 10 ++++++++-- .../search/documents/indexes/aio/_operations/_patch.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py index 1c8775441415..a36138c7e01c 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py @@ -341,8 +341,14 @@ def list_indexes( :raises ~azure.core.exceptions.HttpResponseError: """ if select is not None: - return self.list_indexes_with_selected_properties(select=select, **kwargs) - return self._list_indexes(**kwargs) + return cast( + ItemPaged[Union[_models.SearchIndex, _models.SearchIndexResponse]], + self.list_indexes_with_selected_properties(select=select, **kwargs), + ) + return cast( + ItemPaged[Union[_models.SearchIndex, _models.SearchIndexResponse]], + self._list_indexes(**kwargs), + ) @distributed_trace def list_index_names(self, **kwargs: Any) -> ItemPaged[str]: diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py index b86728d894f5..8ed6e575a5a3 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py @@ -352,8 +352,14 @@ def list_indexes( :raises ~azure.core.exceptions.HttpResponseError: """ if select is not None: - return self.list_indexes_with_selected_properties(select=select, **kwargs) - return self._list_indexes(**kwargs) + return cast( + AsyncItemPaged[Union[_models.SearchIndex, _models.SearchIndexResponse]], + self.list_indexes_with_selected_properties(select=select, **kwargs), + ) + return cast( + AsyncItemPaged[Union[_models.SearchIndex, _models.SearchIndexResponse]], + self._list_indexes(**kwargs), + ) @distributed_trace def list_index_names(self, **kwargs: Any) -> AsyncItemPaged[str]: From 84bc0a4f1a8b0210638f3f70c7c812378a6db092 Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Thu, 12 Feb 2026 10:40:49 -0800 Subject: [PATCH 3/8] use function overloads --- .../documents/indexes/_operations/_patch.py | 23 ++++++++++--------- .../indexes/aio/_operations/_patch.py | 23 ++++++++++--------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py index a36138c7e01c..92ef788a0400 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py @@ -8,7 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import Any, cast, List, Sequence, Union, Optional, TYPE_CHECKING +from typing import Any, cast, List, overload, Sequence, Union, Optional, TYPE_CHECKING from azure.core import MatchConditions from azure.core.paging import ItemPaged @@ -325,10 +325,16 @@ def delete_knowledge_source( **kwargs, ) + @overload + def list_indexes(self, **kwargs: Any) -> ItemPaged[_models.SearchIndex]: ... + + @overload + def list_indexes(self, *, select: List[str], **kwargs: Any) -> ItemPaged[_models.SearchIndexResponse]: ... + @distributed_trace def list_indexes( self, *, select: Optional[List[str]] = None, **kwargs: Any - ) -> ItemPaged[Union[_models.SearchIndex, _models.SearchIndexResponse]]: + ) -> Union[ItemPaged[_models.SearchIndex], ItemPaged[_models.SearchIndexResponse]]: """Lists all indexes available for a search service. :keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated @@ -337,18 +343,13 @@ def list_indexes( SearchIndexResponse objects. Default value is None. :paramtype select: list[str] :return: An iterator like instance of SearchIndex or SearchIndexResponse - :rtype: ~azure.core.paging.ItemPaged[Union[~azure.search.documents.indexes.models.SearchIndex, ~azure.search.documents.indexes.models.SearchIndexResponse]] + :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndex] or + ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndexResponse] :raises ~azure.core.exceptions.HttpResponseError: """ if select is not None: - return cast( - ItemPaged[Union[_models.SearchIndex, _models.SearchIndexResponse]], - self.list_indexes_with_selected_properties(select=select, **kwargs), - ) - return cast( - ItemPaged[Union[_models.SearchIndex, _models.SearchIndexResponse]], - self._list_indexes(**kwargs), - ) + return self.list_indexes_with_selected_properties(select=select, **kwargs) + return self._list_indexes(**kwargs) @distributed_trace def list_index_names(self, **kwargs: Any) -> ItemPaged[str]: diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py index 8ed6e575a5a3..aaabf86db8be 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py @@ -8,7 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import Any, cast, List, Sequence, Union, Optional, TYPE_CHECKING +from typing import Any, cast, List, overload, Sequence, Union, Optional, TYPE_CHECKING from azure.core import MatchConditions from azure.core.async_paging import AsyncItemPaged @@ -336,10 +336,16 @@ async def delete_knowledge_source( **kwargs, ) + @overload + def list_indexes(self, **kwargs: Any) -> AsyncItemPaged[_models.SearchIndex]: ... + + @overload + def list_indexes(self, *, select: List[str], **kwargs: Any) -> AsyncItemPaged[_models.SearchIndexResponse]: ... + @distributed_trace def list_indexes( self, *, select: Optional[List[str]] = None, **kwargs: Any - ) -> AsyncItemPaged[Union[_models.SearchIndex, _models.SearchIndexResponse]]: + ) -> Union[AsyncItemPaged[_models.SearchIndex], AsyncItemPaged[_models.SearchIndexResponse]]: """Lists all indexes available for a search service. :keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated @@ -348,18 +354,13 @@ def list_indexes( SearchIndexResponse objects. Default value is None. :paramtype select: list[str] :return: An async iterator like instance of SearchIndex or SearchIndexResponse - :rtype: ~azure.core.async_paging.AsyncItemPaged[Union[~azure.search.documents.indexes.models.SearchIndex, ~azure.search.documents.indexes.models.SearchIndexResponse]] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchIndex] or + ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchIndexResponse] :raises ~azure.core.exceptions.HttpResponseError: """ if select is not None: - return cast( - AsyncItemPaged[Union[_models.SearchIndex, _models.SearchIndexResponse]], - self.list_indexes_with_selected_properties(select=select, **kwargs), - ) - return cast( - AsyncItemPaged[Union[_models.SearchIndex, _models.SearchIndexResponse]], - self._list_indexes(**kwargs), - ) + return self.list_indexes_with_selected_properties(select=select, **kwargs) + return self._list_indexes(**kwargs) @distributed_trace def list_index_names(self, **kwargs: Any) -> AsyncItemPaged[str]: From da0f790a389f288a1827ab8ea7c5ded36f1a46ce Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Thu, 12 Feb 2026 11:10:32 -0800 Subject: [PATCH 4/8] update --- .../azure/search/documents/indexes/_operations/_patch.py | 2 +- .../azure/search/documents/indexes/aio/_operations/_patch.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py index 92ef788a0400..98d8ea567cf1 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py @@ -326,7 +326,7 @@ def delete_knowledge_source( ) @overload - def list_indexes(self, **kwargs: Any) -> ItemPaged[_models.SearchIndex]: ... + def list_indexes(self, *, select: None = None, **kwargs: Any) -> ItemPaged[_models.SearchIndex]: ... @overload def list_indexes(self, *, select: List[str], **kwargs: Any) -> ItemPaged[_models.SearchIndexResponse]: ... diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py index aaabf86db8be..cba1f3464556 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py @@ -337,7 +337,7 @@ async def delete_knowledge_source( ) @overload - def list_indexes(self, **kwargs: Any) -> AsyncItemPaged[_models.SearchIndex]: ... + def list_indexes(self, *, select: None = None, **kwargs: Any) -> AsyncItemPaged[_models.SearchIndex]: ... @overload def list_indexes(self, *, select: List[str], **kwargs: Any) -> AsyncItemPaged[_models.SearchIndexResponse]: ... From 7f649dab62962f2fc19701b9a9e40aa896e7b7d4 Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Thu, 12 Feb 2026 16:55:33 -0800 Subject: [PATCH 5/8] hide list_indexes_with_selected_properties --- .../azure/search/documents/indexes/_operations/_operations.py | 2 +- .../azure/search/documents/indexes/_operations/_patch.py | 2 +- .../search/documents/indexes/aio/_operations/_operations.py | 2 +- .../azure/search/documents/indexes/aio/_operations/_patch.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py index af167b448c85..c8d8553e9eb6 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py @@ -2317,7 +2317,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_indexes_with_selected_properties( + def _list_indexes_with_selected_properties( self, *, select: Optional[list[str]] = None, **kwargs: Any ) -> ItemPaged["_models1.SearchIndexResponse"]: """Lists all indexes available for a search service. diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py index 98d8ea567cf1..fdf4c01e104a 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py @@ -348,7 +348,7 @@ def list_indexes( :raises ~azure.core.exceptions.HttpResponseError: """ if select is not None: - return self.list_indexes_with_selected_properties(select=select, **kwargs) + return self._list_indexes_with_selected_properties(select=select, **kwargs) return self._list_indexes(**kwargs) @distributed_trace diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py index 6056861f47d8..f2d3d4d322fa 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py @@ -926,7 +926,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list_indexes_with_selected_properties( + def _list_indexes_with_selected_properties( self, *, select: Optional[list[str]] = None, **kwargs: Any ) -> AsyncItemPaged["_models2.SearchIndexResponse"]: """Lists all indexes available for a search service. diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py index cba1f3464556..6a8c26d798b8 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py @@ -359,7 +359,7 @@ def list_indexes( :raises ~azure.core.exceptions.HttpResponseError: """ if select is not None: - return self.list_indexes_with_selected_properties(select=select, **kwargs) + return self._list_indexes_with_selected_properties(select=select, **kwargs) return self._list_indexes(**kwargs) @distributed_trace From e3b06e4fcb84066d08618245c1ca3e01f9451a7d Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Thu, 12 Feb 2026 17:05:24 -0800 Subject: [PATCH 6/8] updates --- .../indexes/_operations/_operations.py | 8 +-- .../documents/indexes/_operations/_patch.py | 56 +++++++++++++------ .../indexes/aio/_operations/_operations.py | 8 +-- .../indexes/aio/_operations/_patch.py | 56 +++++++++++++------ .../documents/indexes/models/__init__.py | 2 - 5 files changed, 86 insertions(+), 44 deletions(-) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py index c8d8553e9eb6..9c6bdec0d3fc 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py @@ -2319,7 +2319,7 @@ def get_next(next_link=None): @distributed_trace def _list_indexes_with_selected_properties( self, *, select: Optional[list[str]] = None, **kwargs: Any - ) -> ItemPaged["_models1.SearchIndexResponse"]: + ) -> ItemPaged["_models1._models.SearchIndexResponse"]: """Lists all indexes available for a search service. :keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated @@ -2328,13 +2328,13 @@ def _list_indexes_with_selected_properties( :paramtype select: list[str] :return: An iterator like instance of SearchIndexResponse :rtype: - ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndexResponse] + ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models._models.SearchIndexResponse] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[list[_models1.SearchIndexResponse]] = kwargs.pop("cls", None) + cls: ClsType[list[_models1._models.SearchIndexResponse]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2384,7 +2384,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models1.SearchIndexResponse], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models1._models.SearchIndexResponse], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py index fdf4c01e104a..be39b616c96e 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py @@ -8,7 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import Any, cast, List, overload, Sequence, Union, Optional, TYPE_CHECKING +from typing import Any, cast, List, Sequence, Union, Optional, TYPE_CHECKING from azure.core import MatchConditions from azure.core.paging import ItemPaged @@ -24,6 +24,31 @@ import azure.search.documents +def _convert_index_response(response: _models.SearchIndexResponse) -> _models.SearchIndex: + """Convert a SearchIndexResponse to a SearchIndex.""" + return _models.SearchIndex( + name=response.name, + fields=response.fields or [], + description=response.description, + scoring_profiles=response.scoring_profiles, + default_scoring_profile=response.default_scoring_profile, + cors_options=response.cors_options, + suggesters=response.suggesters, + analyzers=response.analyzers, + tokenizers=response.tokenizers, + token_filters=response.token_filters, + char_filters=response.char_filters, + normalizers=response.normalizers, + encryption_key=response.encryption_key, + similarity=response.similarity, + semantic_search=response.semantic, + vector_search=response.vector_search, + permission_filter_option=response.permission_filter_option, + purview_enabled=response.purview_enabled, + e_tag=response.e_tag, + ) + + class _SearchIndexClientOperationsMixin(_SearchIndexClientOperationsMixinGenerated): """Custom operations mixin for SearchIndexClient.""" @@ -325,30 +350,27 @@ def delete_knowledge_source( **kwargs, ) - @overload - def list_indexes(self, *, select: None = None, **kwargs: Any) -> ItemPaged[_models.SearchIndex]: ... - - @overload - def list_indexes(self, *, select: List[str], **kwargs: Any) -> ItemPaged[_models.SearchIndexResponse]: ... - @distributed_trace - def list_indexes( - self, *, select: Optional[List[str]] = None, **kwargs: Any - ) -> Union[ItemPaged[_models.SearchIndex], ItemPaged[_models.SearchIndexResponse]]: + def list_indexes(self, *, select: Optional[List[str]] = None, **kwargs: Any) -> ItemPaged[_models.SearchIndex]: """Lists all indexes available for a search service. :keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated - list of JSON property names, or '*' for all properties. The default is all properties. If - select is provided, uses the list_indexes_with_selected_properties endpoint which returns - SearchIndexResponse objects. Default value is None. + list of JSON property names, or '*' for all properties. The default is all properties. + Default value is None. :paramtype select: list[str] - :return: An iterator like instance of SearchIndex or SearchIndexResponse - :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndex] or - ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndexResponse] + :return: An iterator like instance of SearchIndex + :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndex] :raises ~azure.core.exceptions.HttpResponseError: """ if select is not None: - return self._list_indexes_with_selected_properties(select=select, **kwargs) + return cast( + ItemPaged[_models.SearchIndex], + self._list_indexes_with_selected_properties( + select=select, + cls=lambda objs: [_convert_index_response(x) for x in objs], + **kwargs, + ), + ) return self._list_indexes(**kwargs) @distributed_trace diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py index f2d3d4d322fa..b3e598bea751 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py @@ -928,7 +928,7 @@ async def get_next(next_link=None): @distributed_trace def _list_indexes_with_selected_properties( self, *, select: Optional[list[str]] = None, **kwargs: Any - ) -> AsyncItemPaged["_models2.SearchIndexResponse"]: + ) -> AsyncItemPaged["_models2._models.SearchIndexResponse"]: """Lists all indexes available for a search service. :keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated @@ -937,13 +937,13 @@ def _list_indexes_with_selected_properties( :paramtype select: list[str] :return: An iterator like instance of SearchIndexResponse :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchIndexResponse] + ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models._models.SearchIndexResponse] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[list[_models2.SearchIndexResponse]] = kwargs.pop("cls", None) + cls: ClsType[list[_models2._models.SearchIndexResponse]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -993,7 +993,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models2.SearchIndexResponse], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models2._models.SearchIndexResponse], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py index 6a8c26d798b8..0a996fddd797 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py @@ -8,7 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import Any, cast, List, overload, Sequence, Union, Optional, TYPE_CHECKING +from typing import Any, cast, List, Sequence, Union, Optional, TYPE_CHECKING from azure.core import MatchConditions from azure.core.async_paging import AsyncItemPaged @@ -25,6 +25,31 @@ import azure.search.documents.aio +def _convert_index_response(response: _models.SearchIndexResponse) -> _models.SearchIndex: + """Convert a SearchIndexResponse to a SearchIndex.""" + return _models.SearchIndex( + name=response.name, + fields=response.fields or [], + description=response.description, + scoring_profiles=response.scoring_profiles, + default_scoring_profile=response.default_scoring_profile, + cors_options=response.cors_options, + suggesters=response.suggesters, + analyzers=response.analyzers, + tokenizers=response.tokenizers, + token_filters=response.token_filters, + char_filters=response.char_filters, + normalizers=response.normalizers, + encryption_key=response.encryption_key, + similarity=response.similarity, + semantic_search=response.semantic, + vector_search=response.vector_search, + permission_filter_option=response.permission_filter_option, + purview_enabled=response.purview_enabled, + e_tag=response.e_tag, + ) + + class _SearchIndexClientOperationsMixin(_SearchIndexClientOperationsMixinGenerated): """Custom operations mixin for SearchIndexClient (async).""" @@ -336,30 +361,27 @@ async def delete_knowledge_source( **kwargs, ) - @overload - def list_indexes(self, *, select: None = None, **kwargs: Any) -> AsyncItemPaged[_models.SearchIndex]: ... - - @overload - def list_indexes(self, *, select: List[str], **kwargs: Any) -> AsyncItemPaged[_models.SearchIndexResponse]: ... - @distributed_trace - def list_indexes( - self, *, select: Optional[List[str]] = None, **kwargs: Any - ) -> Union[AsyncItemPaged[_models.SearchIndex], AsyncItemPaged[_models.SearchIndexResponse]]: + def list_indexes(self, *, select: Optional[List[str]] = None, **kwargs: Any) -> AsyncItemPaged[_models.SearchIndex]: """Lists all indexes available for a search service. :keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated - list of JSON property names, or '*' for all properties. The default is all properties. If - select is provided, uses the list_indexes_with_selected_properties endpoint which returns - SearchIndexResponse objects. Default value is None. + list of JSON property names, or '*' for all properties. The default is all properties. + Default value is None. :paramtype select: list[str] - :return: An async iterator like instance of SearchIndex or SearchIndexResponse - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchIndex] or - ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchIndexResponse] + :return: An async iterator like instance of SearchIndex + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchIndex] :raises ~azure.core.exceptions.HttpResponseError: """ if select is not None: - return self._list_indexes_with_selected_properties(select=select, **kwargs) + return cast( + AsyncItemPaged[_models.SearchIndex], + self._list_indexes_with_selected_properties( + select=select, + cls=lambda objs: [_convert_index_response(x) for x in objs], + **kwargs, + ), + ) return self._list_indexes(**kwargs) @distributed_trace diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py index 7809bb21937c..bebb2d41130c 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py @@ -150,7 +150,6 @@ SearchIndexFieldReference, SearchIndexKnowledgeSource, SearchIndexKnowledgeSourceParameters, - SearchIndexResponse, SearchIndexer, SearchIndexerCache, SearchIndexerDataContainer, @@ -441,7 +440,6 @@ "SearchIndexFieldReference", "SearchIndexKnowledgeSource", "SearchIndexKnowledgeSourceParameters", - "SearchIndexResponse", "SearchIndexer", "SearchIndexerCache", "SearchIndexerDataContainer", From 198819a6e4564b4b815a20f0a2f85f9a4d7289b1 Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Thu, 12 Feb 2026 17:39:03 -0800 Subject: [PATCH 7/8] fix failure --- .../documents/indexes/_operations/_patch.py | 3 ++- .../indexes/aio/_operations/_patch.py | 26 +------------------ 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py index be39b616c96e..32f8509b9989 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py @@ -15,6 +15,7 @@ from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from ..models._models import SearchIndexResponse as _SearchIndexResponse from ._operations import ( _SearchIndexClientOperationsMixin as _SearchIndexClientOperationsMixinGenerated, _SearchIndexerClientOperationsMixin as _SearchIndexerClientOperationsMixinGenerated, @@ -24,7 +25,7 @@ import azure.search.documents -def _convert_index_response(response: _models.SearchIndexResponse) -> _models.SearchIndex: +def _convert_index_response(response: _SearchIndexResponse) -> _models.SearchIndex: """Convert a SearchIndexResponse to a SearchIndex.""" return _models.SearchIndex( name=response.name, diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py index 0a996fddd797..3a0b6b321e96 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py @@ -16,6 +16,7 @@ from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models +from ..._operations._patch import _convert_index_response from ._operations import ( _SearchIndexClientOperationsMixin as _SearchIndexClientOperationsMixinGenerated, _SearchIndexerClientOperationsMixin as _SearchIndexerClientOperationsMixinGenerated, @@ -25,31 +26,6 @@ import azure.search.documents.aio -def _convert_index_response(response: _models.SearchIndexResponse) -> _models.SearchIndex: - """Convert a SearchIndexResponse to a SearchIndex.""" - return _models.SearchIndex( - name=response.name, - fields=response.fields or [], - description=response.description, - scoring_profiles=response.scoring_profiles, - default_scoring_profile=response.default_scoring_profile, - cors_options=response.cors_options, - suggesters=response.suggesters, - analyzers=response.analyzers, - tokenizers=response.tokenizers, - token_filters=response.token_filters, - char_filters=response.char_filters, - normalizers=response.normalizers, - encryption_key=response.encryption_key, - similarity=response.similarity, - semantic_search=response.semantic, - vector_search=response.vector_search, - permission_filter_option=response.permission_filter_option, - purview_enabled=response.purview_enabled, - e_tag=response.e_tag, - ) - - class _SearchIndexClientOperationsMixin(_SearchIndexClientOperationsMixinGenerated): """Custom operations mixin for SearchIndexClient (async).""" From fcbeb82f9b6d9859b3c7ab06a4fa451cdd95ae3f Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Fri, 13 Feb 2026 15:46:42 -0800 Subject: [PATCH 8/8] fix pylint --- .../azure/search/documents/indexes/_operations/_patch.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py index 32f8509b9989..139fb1ad179b 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py @@ -26,7 +26,13 @@ def _convert_index_response(response: _SearchIndexResponse) -> _models.SearchIndex: - """Convert a SearchIndexResponse to a SearchIndex.""" + """Convert a SearchIndexResponse to a SearchIndex. + + :param response: The SearchIndexResponse to convert. + :type response: ~azure.search.documents.indexes.models._models.SearchIndexResponse + :return: The converted SearchIndex. + :rtype: ~azure.search.documents.indexes.models.SearchIndex + """ return _models.SearchIndex( name=response.name, fields=response.fields or [],