共用方式為


SearchClient.Search Method

Definition

Overloads

Search<T>(SearchOptions, CancellationToken)

Searches for documents in the search index. Search Documents

Search<T>(String, SearchOptions, CancellationToken)

Searches for documents in the search index. Search Documents

Search<T>(SearchOptions, CancellationToken)

Source:
SearchClient.cs
Source:
SearchClient.cs

Searches for documents in the search index. Search Documents

public virtual Azure.Response<Azure.Search.Documents.Models.SearchResults<T>> Search<T> (Azure.Search.Documents.SearchOptions options, System.Threading.CancellationToken cancellationToken = default);
abstract member Search : Azure.Search.Documents.SearchOptions * System.Threading.CancellationToken -> Azure.Response<Azure.Search.Documents.Models.SearchResults<'T>>
override this.Search : Azure.Search.Documents.SearchOptions * System.Threading.CancellationToken -> Azure.Response<Azure.Search.Documents.Models.SearchResults<'T>>
Public Overridable Function Search(Of T) (options As SearchOptions, Optional cancellationToken As CancellationToken = Nothing) As Response(Of SearchResults(Of T))

Type Parameters

T

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

Parameters

options
SearchOptions

Options that allow specifying filtering, sorting, faceting, paging, and other search query behaviors.

cancellationToken
CancellationToken

Optional CancellationToken to propagate notifications that the operation should be canceled.

Returns

Response containing the documents matching the query.

Exceptions

Thrown when a failure is returned by the Search Service.

Remarks

Search and SearchAsync methods support mapping of search field types to .NET types via the type parameter T. You can provide your own type T or use the dynamic SearchDocument. See GetDocumentAsync<T>(String, GetDocumentOptions, CancellationToken) for more details on the type mapping.

Azure Cognitive Search might not be able to include all results in a single response in which case GetResults() will automatically continue making additional requests as you enumerate through the results. You can also process the results a page at a time with the AsPages(String, Nullable<Int32>) method.

Applies to

Search<T>(String, SearchOptions, CancellationToken)

Source:
SearchClient.cs
Source:
SearchClient.cs

Searches for documents in the search index. Search Documents

public virtual Azure.Response<Azure.Search.Documents.Models.SearchResults<T>> Search<T> (string searchText, Azure.Search.Documents.SearchOptions options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member Search : string * Azure.Search.Documents.SearchOptions * System.Threading.CancellationToken -> Azure.Response<Azure.Search.Documents.Models.SearchResults<'T>>
override this.Search : string * Azure.Search.Documents.SearchOptions * System.Threading.CancellationToken -> Azure.Response<Azure.Search.Documents.Models.SearchResults<'T>>
Public Overridable Function Search(Of T) (searchText As String, Optional options As SearchOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Response(Of SearchResults(Of T))

Type Parameters

T

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

Parameters

searchText
String

A full-text search query expression; Use "*" or omit this parameter to match all documents. See Simple query syntax in Azure Cognitive Search for more information about search query syntax.

options
SearchOptions

Options that allow specifying filtering, sorting, faceting, paging, and other search query behaviors.

cancellationToken
CancellationToken

Optional CancellationToken to propagate notifications that the operation should be canceled.

Returns

Response containing the documents matching the query.

Exceptions

Thrown when a failure is returned by the Search Service.

Remarks

Search and SearchAsync methods support mapping of search field types to .NET types via the type parameter T. You can provide your own type T or use the dynamic SearchDocument. See GetDocumentAsync<T>(String, GetDocumentOptions, CancellationToken) for more details on the type mapping.

Azure Cognitive Search might not be able to include all results in a single response in which case GetResults() will automatically continue making additional requests as you enumerate through the results. You can also process the results a page at a time with the AsPages(String, Nullable<Int32>) method.

Applies to