Skip to content

[Azure Search] SDK for Autocomplete#4338

Merged
brjohnstmsft merged 6 commits intoAzure:search-previewfrom
mhko:ac3
May 21, 2018
Merged

[Azure Search] SDK for Autocomplete#4338
brjohnstmsft merged 6 commits intoAzure:search-previewfrom
mhko:ac3

Conversation

@mhko
Copy link
Member

@mhko mhko commented May 18, 2018

@brjohnstmsft.

While the swagger spec for autocomplete is being reviewed (https://github.com/Azure/azure-rest-api-specs-pr/pull/473). I wanted to share this PR with you for early visibility. Once the PR on the swagger spec is reviewed and merged, I will regenerate this code from the spec the right way and update this PR.

Description


This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

SDK Generation Guidelines

  • If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
  • The generate.cmd file for the SDK has been updated with the version of AutoRest, as well as the commitid of your swagger spec or link to the swagger spec, used to generate the code.
  • The *.csproj and AssemblyInfo.cs files have been updated with the new version of the SDK.

brjohnstmsft and others added 4 commits May 11, 2018 12:10
The Autocomplete tests needed to be re-recorded since they were orginally
recorded for an older api-version (2016-09-01-Preview). SearchTests needed to
be re-recorded because the test data changed as part of implementing the
Autocomplete tests.
@dsgouda
Copy link
Contributor

dsgouda commented May 18, 2018

@mhko Please fix test failures

@brjohnstmsft
Copy link
Member

@mhko It looks like you forgot to add the new SessionRecords that you recorded for the Autocomplete tests. Always make sure that tests pass in Playback mode before submitting a PR.

@brjohnstmsft
Copy link
Member

@mhko Please always include [Azure Search] in your commit messages

/// highlighting is disabled.</param>
/// <param name="minimumCoverage">A number between 0 and 100 indicating
/// the percentage of the index that must be covered by a suggestion
/// the percentage of the index that must be covered by am autocomplete
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

am autocomplete -> an autocomplete

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the swagger spec.

/// <summary>
/// Gets or sets the comma-separated list of field names to consider
/// when querying for suggestions.
/// when querying for autucompleted terms.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autucompleted -> auto-completed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Fixed in the swagger spec.

string suggesterName,
SearchRequestOptions searchRequestOptions = default(SearchRequestOptions),
AutocompleteParametersPayload autocompleteParametersPayload = null,
AutocompleteParameters autocompleteParametersPayload = null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter shouldn't have "payload" in the name

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

else
{
string searchFieldsStr = null;
if (autocompleteParameters != null && autocompleteParameters.SearchFields != null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: You can shorten this to if (autocompleteParameters?.SearchFields != null)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

if (searchFields != null)
{
_queryParameters.Add(string.Format("searchFields={0}", System.Uri.EscapeDataString(searchFields)));
_queryParameters.Add(string.Format("searchFields={0}", System.Uri.EscapeDataString(string.Join(",", searchFields))));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, AutoRest understands comma-separated parameters? That's pretty cool!

"Entries": [
{
"RequestUri": "/subscriptions/3c729b2a-4f86-4bb2-abe8-4b8647af156c/resourceGroups/azsmnet4511/providers/Microsoft.Search/searchServices/azs-7938?api-version=2015-08-19",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvM2M3MjliMmEtNGY4Ni00YmIyLWFiZTgtNGI4NjQ3YWYxNTZjL3Jlc291cmNlR3JvdXBzL2F6c21uZXQ0NTExL3Byb3ZpZGVycy9NaWNyb3NvZnQuU2VhcmNoL3NlYXJjaFNlcnZpY2VzL2F6cy03OTM4P2FwaS12ZXJzaW9uPTIwMTUtMDgtMTk=",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very wrong. There's only a call to ARM to delete the test search service.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing it. It looks like this session was recorded while refactoring was in progress. This test doesn't exist anymore.

@@ -172,7 +172,7 @@ protected void TestAutocompleteWithSelectedFields()
SearchIndexClient client = GetClientForQuery();
var autocompleteParameters = new AutocompleteParameters()
{
SearchFields = "hotelName"
SearchFields = new[] { "hotelName" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need tests with more than one search field.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added one more

@brjohnstmsft
Copy link
Member

@mhko This looks good. I'm going to go ahead and merge it, and you can submit another PR once the Swagger PR is merged and you're able to regenerate the code from the spec in Azure/master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants