Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

port: Add support for search invoke (#6272) #1458

Closed

Description

@github-actions

The changes in Add support for search invoke (#6272) may need to be ported to maintain parity with microsoft/botbuilder-dotnet.

Fixes #5643

OnInvokeActivityAsync here:
https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/bot-type-ahead-search-adaptive-cards/csharp/TypeaheadSearch/Bots/ActivityBot.cs#L85

Would be changed to:

protected override async Task<SearchInvokeResponse> OnSearchInvokeAsync(ITurnContext<IInvokeActivity> turnContext, SearchInvokeValue invokeValue, CancellationToken cancellationToken)
{
    var packageResult = JObject.Parse(await(new HttpClient()).GetStringAsync($"https://azuresearch-usnc.nuget.org/query?q=id:{invokeValue.QueryText}&prerelease=true"));
    if (packageResult == null)
    {
        // no results available, return 204
        return new SearchInvokeResponse
        {
            Type = "application/vnd.microsoft.search.searchResponse",
            StatusCode = 204
        };
    }
    else
    {
        var packageList = packageResult["data"]
            .Skip(invokeValue.QueryOptions.Skip)
            .Take(invokeValue.QueryOptions.Top)
            .Select(item => (item["id"].ToString(), item["description"].ToString()))
            .Select(item => new { title = item.Item1, value = item.Item1 + " - " + item.Item2 })
            .ToList();
        
        return new SearchInvokeResponse
        {
            Type = "application/vnd.microsoft.search.searchResponse",
            Value = JObject.FromObject(new { results = packageList }),
            StatusCode = 200
        };
    }
}

Please review and, if necessary, port the changes.

Activity

  1. added
    ExemptFromDailyDRIReportUse this label to exclude the issue from the DRI report.
    needs-triageThe issue has just been created and it has not been reviewed by the team.
    parityThe issue describes a gap in parity between two or more platforms.
    on Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExemptFromDailyDRIReportUse this label to exclude the issue from the DRI report.needs-triageThe issue has just been created and it has not been reviewed by the team.parityThe issue describes a gap in parity between two or more platforms.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions