你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

DocumentsOperationsExtensions.SearchAsync 方法

定义

重载

SearchAsync(IDocumentsOperations, String, SearchParameters, SearchRequestOptions, CancellationToken)

在搜索索引中搜索文档。 https://docs.microsoft.com/rest/api/searchservice/Search-Documents

SearchAsync<T>(IDocumentsOperations, String, SearchParameters, SearchRequestOptions, CancellationToken)

在搜索索引中搜索文档。 https://docs.microsoft.com/rest/api/searchservice/Search-Documents

SearchAsync(IDocumentsOperations, String, SearchParameters, SearchRequestOptions, CancellationToken)

Source:
DocumentsOperationsExtensions.cs
public static System.Threading.Tasks.Task<Microsoft.Azure.Search.Models.DocumentSearchResult<Microsoft.Azure.Search.Models.Document>> SearchAsync (this Microsoft.Azure.Search.IDocumentsOperations operations, string searchText, Microsoft.Azure.Search.Models.SearchParameters searchParameters = default, Microsoft.Azure.Search.Models.SearchRequestOptions searchRequestOptions = default, System.Threading.CancellationToken cancellationToken = default);
static member SearchAsync : Microsoft.Azure.Search.IDocumentsOperations * string * Microsoft.Azure.Search.Models.SearchParameters * Microsoft.Azure.Search.Models.SearchRequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Search.Models.DocumentSearchResult<Microsoft.Azure.Search.Models.Document>>
<Extension()>
Public Function SearchAsync (operations As IDocumentsOperations, searchText As String, Optional searchParameters As SearchParameters = Nothing, Optional searchRequestOptions As SearchRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DocumentSearchResult(Of Document))

参数

operations
IDocumentsOperations

此扩展方法的操作组。

searchText
String

全文搜索查询表达式;使用 null 或“*”匹配所有文档。 有关搜索查询语法的详细信息,请参阅 https://docs.microsoft.com/rest/api/searchservice/Simple-query-syntax-in-Azure-Search

searchParameters
SearchParameters

用于进一步优化搜索查询的参数。

searchRequestOptions
SearchRequestOptions

操作的其他参数

cancellationToken
CancellationToken

取消标记。

返回

包含与查询匹配的文档的响应。

注解

Search、SearchAsync 和 SearchWithHttpMessagesAsync 方法的非泛型重载会尽力尝试将响应有效负载中的 JSON 类型映射到 .NET 类型。 有关详细信息,请参阅GetWithHttpMessagesAsync(String, IEnumerable<String>, SearchRequestOptions, Dictionary<String,List<String>>, CancellationToken)

如果Azure 认知搜索无法在单个响应中包含所有结果,则返回的响应将包含一个延续标记,该标记可传递给 ContinueSearch 以检索更多结果。 有关详细信息,请参阅DocumentSearchResult.ContinuationToken

适用于

SearchAsync<T>(IDocumentsOperations, String, SearchParameters, SearchRequestOptions, CancellationToken)

Source:
DocumentsOperationsExtensions.cs
public static System.Threading.Tasks.Task<Microsoft.Azure.Search.Models.DocumentSearchResult<T>> SearchAsync<T> (this Microsoft.Azure.Search.IDocumentsOperations operations, string searchText, Microsoft.Azure.Search.Models.SearchParameters searchParameters = default, Microsoft.Azure.Search.Models.SearchRequestOptions searchRequestOptions = default, System.Threading.CancellationToken cancellationToken = default);
static member SearchAsync : Microsoft.Azure.Search.IDocumentsOperations * string * Microsoft.Azure.Search.Models.SearchParameters * Microsoft.Azure.Search.Models.SearchRequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Search.Models.DocumentSearchResult<'T>>
<Extension()>
Public Function SearchAsync(Of T) (operations As IDocumentsOperations, searchText As String, Optional searchParameters As SearchParameters = Nothing, Optional searchRequestOptions As SearchRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DocumentSearchResult(Of T))

类型参数

T

映射到索引架构的 CLR 类型。 可以从索引中以文档的形式检索此类型的实例。

参数

operations
IDocumentsOperations

此扩展方法的操作组。

searchText
String

全文搜索查询表达式;使用 null 或“*”匹配所有文档。 有关搜索查询语法的详细信息,请参阅 https://docs.microsoft.com/rest/api/searchservice/Simple-query-syntax-in-Azure-Search

searchParameters
SearchParameters

用于进一步优化搜索查询的参数。

searchRequestOptions
SearchRequestOptions

操作的其他参数

cancellationToken
CancellationToken

取消标记。

返回

包含与查询匹配的文档的响应。

注解

Search、SearchAsync 和 SearchWithHttpMessagesAsync 方法的泛型重载支持通过类型参数 T 将搜索字段类型映射到 .NET 类型。有关类型映射的更多详细信息,请参阅 GetWithHttpMessagesAsync<T>(String, IEnumerable<String>, SearchRequestOptions, Dictionary<String,List<String>>, CancellationToken)

如果Azure 认知搜索无法在单个响应中包含所有结果,则返回的响应将包含一个延续标记,该标记可传递给 ContinueSearch 以检索更多结果。 有关详细信息,请参阅DocumentSearchResult.ContinuationToken

适用于