Skip to content

Commit

Permalink
updating web search sample (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
aahill authored and yangyuan committed Apr 17, 2019
1 parent 303e895 commit a0839ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions BingSearchv7/BingWebSearch/WebSearchSamples.cs
Expand Up @@ -4,19 +4,20 @@
using System.Linq;
using Microsoft.Azure.CognitiveServices.Search.WebSearch;
using Microsoft.Azure.CognitiveServices.Search.WebSearch.Models;
using Microsoft.Rest;
using System.Collections.Generic;

[SampleCollection("WebSearch")]
public class WebSearchSamples
{
[Example("This will look up a single query (Xbox) and print out name and url for first web, image, news and videos results")]
public static void WebSearchResultTypesLookup(string subscriptionKey)
public static async void WebSearchResultTypesLookup(string subscriptionKey)
{
var client = new WebSearchAPI(new ApiKeyServiceClientCredentials(subscriptionKey));
var client = new WebSearchClient(new ApiKeyServiceClientCredentials(subscriptionKey));

try
{
var webData = client.Web.Search(query: "Xbox");
var webData = await client.Web.SearchAsync(query: "Xbox");
Console.WriteLine("Searched for Query# \" Xbox \"");

//WebPages
Expand Down Expand Up @@ -116,9 +117,9 @@ public static void WebSearchResultTypesLookup(string subscriptionKey)
}

[Example("This will search (Best restaurants in Seattle), verify number of results and print out name and url of first result")]
public static void WebResultsWithCountAndOffset(string subscriptionKey)
public static async void WebResultsWithCountAndOffset(string subscriptionKey)
{
var client = new WebSearchAPI(new ApiKeyServiceClientCredentials(subscriptionKey));
var client = new WebSearchClient(new ApiKeyServiceClientCredentials(subscriptionKey));

try
{
Expand Down Expand Up @@ -155,7 +156,7 @@ public static void WebResultsWithCountAndOffset(string subscriptionKey)
[Example("This will search (Microsoft) with response filters to news and print details of news")]
public static void WebSearchWithResponseFilter(string subscriptionKey)
{
var client = new WebSearchAPI(new ApiKeyServiceClientCredentials(subscriptionKey));
var client = new WebSearchClient(new ApiKeyServiceClientCredentials(subscriptionKey));

try
{
Expand Down Expand Up @@ -195,7 +196,7 @@ public static void WebSearchWithResponseFilter(string subscriptionKey)
[Example("This will search (Lady Gaga) with answerCount and promote parameters and print details of answers")]
public static void WebSearchWithAnswerCountPromoteAndSafeSearch(string subscriptionKey)
{
var client = new WebSearchAPI(new ApiKeyServiceClientCredentials(subscriptionKey));
var client = new WebSearchClient(new ApiKeyServiceClientCredentials(subscriptionKey));

try
{
Expand Down
4 changes: 2 additions & 2 deletions BingSearchv7/BingWebSearch/bing-search-dotnet.csproj
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.10" />
<PackageReference Include="Microsoft.Azure.CognitiveServices.Search.WebSearch" Version="1.2.0" />
<PackageReference Include="Microsoft.Azure.CognitiveServices.Search.WebSearch" Version="2.0.0" />
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.20" />
</ItemGroup>

</Project>

0 comments on commit a0839ac

Please sign in to comment.