Condividi tramite


DocumentsOperationsExtensions.SearchAsync Method

Definition

Overloads

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

Searches for documents in the search index. https://docs.microsoft.com/rest/api/searchservice/Search-Documents

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

Searches for documents in the search index. https://docs.microsoft.com/rest/api/searchservice/Search-Documents

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

Source:
DocumentsOperationsExtensions.cs

Searches for documents in the search index. https://docs.microsoft.com/rest/api/searchservice/Search-Documents

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))

Parameters

operations
IDocumentsOperations

The operations group for this extension method.

searchText
String

A full-text search query expression; Use null or "*" to match all documents. See https://docs.microsoft.com/rest/api/searchservice/Simple-query-syntax-in-Azure-Search for more information about search query syntax.

searchParameters
SearchParameters

Parameters to further refine the search query.

searchRequestOptions
SearchRequestOptions

Additional parameters for the operation

cancellationToken
CancellationToken

The cancellation token.

Returns

Response containing the documents matching the query.

Remarks

The non-generic overloads of the Search, SearchAsync, and SearchWithHttpMessagesAsync methods make a best-effort attempt to map JSON types in the response payload to .NET types. See GetWithHttpMessagesAsync(String, IEnumerable<String>, SearchRequestOptions, Dictionary<String,List<String>>, CancellationToken) for more information.

If Azure Cognitive Search can't include all results in a single response, the response returned will include a continuation token that can be passed to ContinueSearch to retrieve more results. See DocumentSearchResult.ContinuationToken for more information.

Applies to

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

Source:
DocumentsOperationsExtensions.cs

Searches for documents in the search index. https://docs.microsoft.com/rest/api/searchservice/Search-Documents

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))

Type Parameters

T

The CLR type that maps to the index schema. Instances of this type can be retrieved as documents from the index.

Parameters

operations
IDocumentsOperations

The operations group for this extension method.

searchText
String

A full-text search query expression; Use null or "*" to match all documents. See https://docs.microsoft.com/rest/api/searchservice/Simple-query-syntax-in-Azure-Search for more information about search query syntax.

searchParameters
SearchParameters

Parameters to further refine the search query.

searchRequestOptions
SearchRequestOptions

Additional parameters for the operation

cancellationToken
CancellationToken

The cancellation token.

Returns

Response containing the documents matching the query.

Remarks

The generic overloads of the Search, SearchAsync, and SearchWithHttpMessagesAsync methods support mapping of search field types to .NET types via the type parameter T. See GetWithHttpMessagesAsync<T>(String, IEnumerable<String>, SearchRequestOptions, Dictionary<String,List<String>>, CancellationToken) for more details on the type mapping.

If Azure Cognitive Search can't include all results in a single response, the response returned will include a continuation token that can be passed to ContinueSearch to retrieve more results. See DocumentSearchResult.ContinuationToken for more information.

Applies to