Skip to content

Commit c36bb90

Browse files
authored
Merge pull request #36 from aahill/b-cs-sdk
adding code references
2 parents bfea783 + 6172e4e commit c36bb90

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Search/BingCustomSearch/src/main/java/com/microsoft/azure/cognitiveservices/search/customsearch/samples/BingCustomSearchSample.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
* Licensed under the MIT License. See License.txt in the project root for
44
* license information.
55
*/
6-
6+
// <imports>
77
package com.microsoft.azure.cognitiveservices.search.customsearch.samples;
88

99
import com.microsoft.azure.cognitiveservices.search.customsearch.BingCustomSearchAPI;
1010
import com.microsoft.azure.cognitiveservices.search.customsearch.BingCustomSearchManager;
1111
import com.microsoft.azure.cognitiveservices.search.customsearch.models.SearchResponse;
1212
import com.microsoft.azure.cognitiveservices.search.customsearch.models.WebPage;
13+
// </imports>
1314

1415
/**
1516
* Sample code for custom searching news using Bing Custom Search, an Azure Cognitive Service.
@@ -22,6 +23,7 @@ public class BingCustomSearchSample {
2223
* @param client instance of the Bing Custom Search API client
2324
* @return true if sample runs successfully
2425
*/
26+
// <runSample>
2527
public static boolean runSample(BingCustomSearchAPI client, String customConfigId) {
2628
try {
2729

@@ -58,23 +60,23 @@ public static boolean runSample(BingCustomSearchAPI client, String customConfigI
5860
}
5961
return false;
6062
}
63+
// </runSample>
6164

6265

6366
/**
6467
* Main entry point.
6568
*
6669
* @param args the parameters
70+
*
6771
*/
72+
// <main>
6873
public static void main(String[] args) {
6974
try {
70-
//=============================================================
71-
// Authenticate
72-
73-
// If you do not have a customConfigId, you can also use 1 as your value when setting your environment variable.
7475

7576
// Set the BING_CUSTOM_SEARCH_SUBSCRIPTION_KEY and AZURE_BING_SAMPLES_CUSTOM_CONFIG_ID environment variables,
7677
// then reopen your command prompt or IDE. If not, you may get an API key not found exception.
7778
final String subscriptionKey = System.getenv("BING_CUSTOM_SEARCH_SUBSCRIPTION_KEY");
79+
// If you do not have a customConfigId, you can also use 1 as your value when setting your environment variable.
7880
final String customConfigId = System.getenv("AZURE_BING_SAMPLES_CUSTOM_CONFIG_ID");
7981

8082
BingCustomSearchAPI client = BingCustomSearchManager.authenticate(subscriptionKey);
@@ -85,4 +87,5 @@ public static void main(String[] args) {
8587
e.printStackTrace();
8688
}
8789
}
90+
// </main>
8891
}

0 commit comments

Comments
 (0)