支持政府社区云(gcc)中的Azure搜索服务



我正在尝试将一些数据索引到搜索服务,并使用政府云中的搜索查询进行检索。搜索服务Url以(.search.azure.us(结尾。这与Url以(.search.windows.net(结尾的普通azure搜索服务不同。

我们的团队使用Azure.Net SDK版本5,我发现当我使用服务名称创建SearchIndexClient时,构造函数会验证服务url,并总是在其末尾添加.search.windows.Net,并且对于*.search.Azure.us.等gcc url将失败

我正在查看Azure搜索客户端库,SearchIndexClient总是使用.search.wndows.net后缀进行验证

private static void ValidateSearchServiceAndIndexNames(string searchServiceName, string indexName)
{
Throw.IfNullOrEmptySearchServiceName(searchServiceName);
SearchIndexClient.ThrowIfNullOrEmptyIndexName(indexName, nameof (indexName));
if (TypeConversion.TryParseUri(string.Format("https://{0}.search.windows.net/indexes('{1}')/", 
(object) searchServiceName, (object) indexName)) == (Uri) null)
throw new ArgumentException(string.Format("Either the search service name '{0}' or the index name 
'{1}' is invalid. Names must contain only characters that are valid in a URL.", (object) 
searchServiceName, (object) indexName), nameof (searchServiceName));
} 

那么,是否有任何升级版的sdk可供搜索索引客户端支持类似".search.azure.us"的URL?或者政府云网址的其他推荐方式?

将searchIndexClient上的SearchDnsSuffix属性正确设置为适当的后缀是否简单?

您能分享一下如何实例化SearchIndexClient吗?我的预感是,你在搜索服务或索引名称中包含了域后缀,这会引发你看到的错误。尝试将SearchDnsSuffix设置为"search.azure.us"。

参考文档:https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.search.searchindexclient.searchdnssuffix?view=azure-dotnet#Microsoft_Azure_Search_SearchIndexClient_SearchDnsSuffix

最新更新