Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Azure Search] Generate code for the Search and ContinueSearch API #5324

Merged
merged 17 commits into from
Mar 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
0b9e7cf
[Azure Search] Regenerate code to pick up some doc fixes
brjohnstmsft Mar 1, 2019
f385d53
[Azure Search] Making some response properties read-only
brjohnstmsft Mar 1, 2019
b787b5b
Removing DocumentSearchResult/SearchResult and their base classes
brjohnstmsft Mar 1, 2019
5536c00
[Azure Search] Remove FacetResults and HitHighlights types
brjohnstmsft Mar 2, 2019
5cdd36a
[Azure Search] Make SearchResult/FacetResult/DocumentSearchResult imm…
brjohnstmsft Mar 2, 2019
0e85c97
[Azure Search] Clarify serialization capability of SearchContinuation…
brjohnstmsft Mar 3, 2019
44f12ac
[Azure Search] Generate code for the Search API and its model types
brjohnstmsft Mar 2, 2019
0aef1e0
[Azure Search] Simplify how continuation tokens are constructed
brjohnstmsft Mar 3, 2019
826d030
[Azure Search] Replace Search implementation with generated code
brjohnstmsft Mar 3, 2019
aac990e
[Azure Search] Updating session records
brjohnstmsft Mar 3, 2019
0a9035c
[Azure Search] Replace ContinueSearch implementation with generated code
brjohnstmsft Mar 4, 2019
765c5fb
[Azure Search] Updating session records for ContinueSearch tests
brjohnstmsft Mar 4, 2019
ebac8e1
[Azure Search] Refactor DocumentsOperations & make AutocompleteMode n…
brjohnstmsft Mar 4, 2019
f65a779
[Azure Search] Updating session records
brjohnstmsft Mar 4, 2019
4a58b94
[Azure Search] Regenerate from Swagger spec in master
brjohnstmsft Mar 7, 2019
3b17256
[Azure Search] Allow structs as model classes
brjohnstmsft Mar 7, 2019
e40003c
[Azure Search] Add session records for struct tests
brjohnstmsft Mar 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ namespace Microsoft.Azure.Search.Models
using System.Reflection;

/// <summary>
/// Indicates that the public properties of a model class should be serialized as camel-case in order to match
/// Indicates that the public properties of a model type should be serialized as camel-case in order to match
/// the field names of an Azure Search index.
/// </summary>
/// <remarks>
/// Classes without this attribute are expected to have property names that exactly match their corresponding
/// fields names in Azure Search. Otherwise, it would not be possible to use instances of the class to populate
/// Types without this attribute are expected to have property names that exactly match their corresponding
/// fields names in Azure Search. Otherwise, it would not be possible to use instances of the type to populate
/// the index.
/// </remarks>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = true)]
public class SerializePropertyNamesAsCamelCaseAttribute : Attribute
{
/// <summary>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static async Task<AutocompleteResult> AutocompleteAsync(
/// <para>
/// If Azure 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 <c cref="DocumentSearchResultBase&lt;TResult,TDoc&gt;.ContinuationToken">DocumentSearchResultBase.ContinuationToken</c>
/// See <c cref="DocumentSearchResult&lt;T&gt;.ContinuationToken">DocumentSearchResult.ContinuationToken</c>
/// for more information.
/// </para>
/// <para>
Expand All @@ -138,7 +138,7 @@ public static async Task<AutocompleteResult> AutocompleteAsync(
/// method.
/// </para>
/// </remarks>
public static DocumentSearchResult ContinueSearch(
public static DocumentSearchResult<Document> ContinueSearch(
this IDocumentsOperations operations,
SearchContinuationToken continuationToken,
SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
Expand Down Expand Up @@ -176,7 +176,7 @@ public static DocumentSearchResult ContinueSearch(
/// <para>
/// If Azure 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 <c cref="DocumentSearchResultBase&lt;TResult,TDoc&gt;.ContinuationToken">DocumentSearchResultBase.ContinuationToken</c>
/// See <c cref="DocumentSearchResult&lt;T&gt;.ContinuationToken">DocumentSearchResult.ContinuationToken</c>
/// for more information.
/// </para>
/// <para>
Expand All @@ -187,13 +187,13 @@ public static DocumentSearchResult ContinueSearch(
/// method.
/// </para>
/// </remarks>
public static async Task<DocumentSearchResult> ContinueSearchAsync(
public static async Task<DocumentSearchResult<Document>> ContinueSearchAsync(
this IDocumentsOperations operations,
SearchContinuationToken continuationToken,
SearchRequestOptions searchRequestOptions = default(SearchRequestOptions),
CancellationToken cancellationToken = default(CancellationToken))
{
AzureOperationResponse<DocumentSearchResult> result = await operations.ContinueSearchWithHttpMessagesAsync(continuationToken, searchRequestOptions, null, cancellationToken).ConfigureAwait(false);
AzureOperationResponse<DocumentSearchResult<Document>> result = await operations.ContinueSearchWithHttpMessagesAsync(continuationToken, searchRequestOptions, null, cancellationToken).ConfigureAwait(false);
return result.Body;
}

Expand Down Expand Up @@ -227,7 +227,7 @@ public static async Task<DocumentSearchResult> ContinueSearchAsync(
/// <para>
/// If Azure 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 <c cref="DocumentSearchResultBase&lt;TResult,TDoc&gt;.ContinuationToken">DocumentSearchResultBase.ContinuationToken</c>
/// See <c cref="DocumentSearchResult&lt;T&gt;.ContinuationToken">DocumentSearchResult.ContinuationToken</c>
/// for more information.
/// </para>
/// <para>
Expand All @@ -242,7 +242,6 @@ public static DocumentSearchResult<T> ContinueSearch<T>(
this IDocumentsOperations operations,
SearchContinuationToken continuationToken,
SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
where T : class
{
return operations.ContinueSearchAsync<T>(continuationToken, searchRequestOptions).GetAwaiter().GetResult();
}
Expand Down Expand Up @@ -280,7 +279,7 @@ public static DocumentSearchResult<T> ContinueSearch<T>(
/// <para>
/// If Azure 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 <c cref="DocumentSearchResultBase&lt;TResult,TDoc&gt;.ContinuationToken">DocumentSearchResultBase.ContinuationToken</c>
/// See <c cref="DocumentSearchResult&lt;T&gt;.ContinuationToken">DocumentSearchResult.ContinuationToken</c>
/// for more information.
/// </para>
/// <para>
Expand All @@ -295,7 +294,7 @@ public static async Task<DocumentSearchResult<T>> ContinueSearchAsync<T>(
this IDocumentsOperations operations,
SearchContinuationToken continuationToken,
SearchRequestOptions searchRequestOptions = default(SearchRequestOptions),
CancellationToken cancellationToken = default(CancellationToken)) where T : class
CancellationToken cancellationToken = default(CancellationToken))
{
AzureOperationResponse<DocumentSearchResult<T>> result = await operations.ContinueSearchWithHttpMessagesAsync<T>(continuationToken, searchRequestOptions, null, cancellationToken).ConfigureAwait(false);
return result.Body;
Expand Down Expand Up @@ -418,7 +417,6 @@ public static T Get<T>(
string key,
IEnumerable<string> selectedFields = null,
SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
where T : class
{
return operations.GetAsync<T>(key, selectedFields, searchRequestOptions).GetAwaiter().GetResult();
}
Expand Down Expand Up @@ -464,7 +462,7 @@ public static async Task<T> GetAsync<T>(
string key,
IEnumerable<string> selectedFields = null,
SearchRequestOptions searchRequestOptions = default(SearchRequestOptions),
CancellationToken cancellationToken = default(CancellationToken)) where T : class
CancellationToken cancellationToken = default(CancellationToken))
{
AzureOperationResponse<T> result = await operations.GetWithHttpMessagesAsync<T>(key, selectedFields ?? DocumentsOperations.SelectAll, searchRequestOptions, null, cancellationToken).ConfigureAwait(false);
return result.Body;
Expand Down Expand Up @@ -588,7 +586,6 @@ public static DocumentIndexResult Index<T>(
this IDocumentsOperations operations,
IndexBatch<T> batch,
SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
where T : class
{
return operations.IndexAsync<T>(batch, searchRequestOptions).GetAwaiter().GetResult();
}
Expand Down Expand Up @@ -633,7 +630,7 @@ public static async Task<DocumentIndexResult> IndexAsync<T>(
this IDocumentsOperations operations,
IndexBatch<T> batch,
SearchRequestOptions searchRequestOptions = default(SearchRequestOptions),
CancellationToken cancellationToken = default(CancellationToken)) where T : class
CancellationToken cancellationToken = default(CancellationToken))
{
AzureOperationResponse<DocumentIndexResult> result = await operations.IndexWithHttpMessagesAsync<T>(batch, searchRequestOptions, null, cancellationToken).ConfigureAwait(false);
return result.Body;
Expand Down Expand Up @@ -670,11 +667,11 @@ public static async Task<DocumentIndexResult> IndexAsync<T>(
/// <para>
/// If Azure 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 <c cref="DocumentSearchResultBase&lt;TResult,TDoc&gt;.ContinuationToken">DocumentSearchResultBase.ContinuationToken</c>
/// See <c cref="DocumentSearchResult&lt;T&gt;.ContinuationToken">DocumentSearchResult.ContinuationToken</c>
/// for more information.
/// </para>
/// </remarks>
public static DocumentSearchResult Search(
public static DocumentSearchResult<Document> Search(
this IDocumentsOperations operations,
string searchText,
SearchParameters searchParameters = null,
Expand Down Expand Up @@ -717,18 +714,18 @@ public static DocumentSearchResult Search(
/// <para>
/// If Azure 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 <c cref="DocumentSearchResultBase&lt;TResult,TDoc&gt;.ContinuationToken">DocumentSearchResultBase.ContinuationToken</c>
/// See <c cref="DocumentSearchResult&lt;T&gt;.ContinuationToken">DocumentSearchResult.ContinuationToken</c>
/// for more information.
/// </para>
/// </remarks>
public static async Task<DocumentSearchResult> SearchAsync(
public static async Task<DocumentSearchResult<Document>> SearchAsync(
this IDocumentsOperations operations,
string searchText,
SearchParameters searchParameters = null,
SearchRequestOptions searchRequestOptions = default(SearchRequestOptions),
CancellationToken cancellationToken = default(CancellationToken))
{
AzureOperationResponse<DocumentSearchResult> result = await operations.SearchWithHttpMessagesAsync(searchText, searchParameters ?? new SearchParameters(), searchRequestOptions, null, cancellationToken).ConfigureAwait(false);
AzureOperationResponse<DocumentSearchResult<Document>> result = await operations.SearchWithHttpMessagesAsync(searchText, searchParameters ?? new SearchParameters(), searchRequestOptions, null, cancellationToken).ConfigureAwait(false);
return result.Body;
}

Expand Down Expand Up @@ -767,7 +764,7 @@ public static async Task<DocumentSearchResult> SearchAsync(
/// <para>
/// If Azure 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 <c cref="DocumentSearchResultBase&lt;TResult,TDoc&gt;.ContinuationToken">DocumentSearchResultBase.ContinuationToken</c>
/// See <c cref="DocumentSearchResult&lt;T&gt;.ContinuationToken">DocumentSearchResult.ContinuationToken</c>
/// for more information.
/// </para>
/// </remarks>
Expand All @@ -776,7 +773,6 @@ public static DocumentSearchResult<T> Search<T>(
string searchText,
SearchParameters searchParameters = null,
SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
where T : class
{
return operations.SearchAsync<T>(searchText, searchParameters, searchRequestOptions).GetAwaiter().GetResult();
}
Expand Down Expand Up @@ -819,7 +815,7 @@ public static DocumentSearchResult<T> Search<T>(
/// <para>
/// If Azure 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 <c cref="DocumentSearchResultBase&lt;TResult,TDoc&gt;.ContinuationToken">DocumentSearchResultBase.ContinuationToken</c>
/// See <c cref="DocumentSearchResult&lt;T&gt;.ContinuationToken">DocumentSearchResult.ContinuationToken</c>
/// for more information.
/// </para>
/// </remarks>
Expand All @@ -828,7 +824,7 @@ public static async Task<DocumentSearchResult<T>> SearchAsync<T>(
string searchText,
SearchParameters searchParameters = null,
SearchRequestOptions searchRequestOptions = default(SearchRequestOptions),
CancellationToken cancellationToken = default(CancellationToken)) where T : class
CancellationToken cancellationToken = default(CancellationToken))
{
AzureOperationResponse<DocumentSearchResult<T>> result = await operations.SearchWithHttpMessagesAsync<T>(searchText, searchParameters ?? new SearchParameters(), searchRequestOptions, null, cancellationToken).ConfigureAwait(false);
return result.Body;
Expand Down Expand Up @@ -953,7 +949,6 @@ public static DocumentSuggestResult<T> Suggest<T>(
string suggesterName,
SuggestParameters suggestParameters = null,
SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
where T : class
{
return operations.SuggestAsync<T>(searchText, suggesterName, suggestParameters, searchRequestOptions).GetAwaiter().GetResult();
}
Expand Down Expand Up @@ -999,7 +994,7 @@ public static async Task<DocumentSuggestResult<T>> SuggestAsync<T>(
string suggesterName,
SuggestParameters suggestParameters = null,
SearchRequestOptions searchRequestOptions = default(SearchRequestOptions),
CancellationToken cancellationToken = default(CancellationToken)) where T : class
CancellationToken cancellationToken = default(CancellationToken))
{
AzureOperationResponse<DocumentSuggestResult<T>> result = await operations.SuggestWithHttpMessagesAsync<T>(searchText, suggesterName, suggestParameters ?? new SuggestParameters(), searchRequestOptions, null, cancellationToken).ConfigureAwait(false);
return result.Body;
Expand Down
Loading