This commit is contained in:
unknown 2020-12-16 19:25:52 +02:00
Родитель 926a399621
Коммит 3e9d4733c9
15 изменённых файлов: 130 добавлений и 18 удалений

18
CONTRIBUTING.md Normal file
Просмотреть файл

@ -0,0 +1,18 @@
# Contributing
This project welcomes contributions and suggestions. Most contributions require you to
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
and actually do, grant us the rights to use your contribution. For details, visit
https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
- Submit feedback on [this sample page](https://github.com/microsoft/bing-search-sdk-for-java) whether it was helpful or not.
- Submit issues through [issue tracker](https://github.com/microsoft/bing-search-sdk-for-java/issues) on GitHub. We are actively monitoring the issues and improving our samples.
- If you wish to make code changes to samples, or contribute something new, please follow the [GitHub Forks / Pull requests model](https://help.github.com/articles/fork-a-repo/): Fork the sample repo, make the change and propose it back by submitting a pull request

Просмотреть файл

@ -1,3 +1,4 @@
Bing Search
MIT License
Copyright (c) Microsoft Corporation.

7
PRIVACY.txt Normal file
Просмотреть файл

@ -0,0 +1,7 @@
Data Collection. The software may collect information about you and your use of the software and send it to Microsoft.
Microsoft may use this information to provide services and improve our products and services.
You may turn off the telemetry as described in the repository. There are also some features in the software that may enable
you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law,
including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement.
Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection
and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.

Просмотреть файл

@ -1,14 +1,29 @@
# Project
> This repo has been populated by an initial template to help get you started. Please
> make sure to update the content to build a great experience for community-building.
# Bing Search SDK for Java
As the maintainer of this project, please make a few updates:
[![Packages](https://img.shields.io/badge/packages-latest-blue.svg)](https://azure.github.io/azure-sdk/releases/latest/java.html) [![Dependencies](https://img.shields.io/badge/dependency-report-blue.svg)](https://azuresdkartifacts.blob.core.windows.net/azure-sdk-for-java/staging/dependencies.html) [![DepGraph](https://img.shields.io/badge/dependency-graph-blue.svg)](https://azuresdkartifacts.blob.core.windows.net/azure-sdk-for-java/staging/InterdependencyGraph.html) [![Build Documentation](https://img.shields.io/badge/documentation-published-blue.svg)](https://azuresdkartifacts.blob.core.windows.net/azure-sdk-for-java/index.html) [![SpotBugs](https://img.shields.io/badge/SpotBugs-Clean-success.svg)](https://azuresdkartifacts.blob.core.windows.net/azure-sdk-for-java/staging/spotbugsXml.html) [![CheckStyle](https://img.shields.io/badge/CheckStyle-Clean-success.svg)](https://azuresdkartifacts.blob.core.windows.net/azure-sdk-for-java/staging/checkstyle-aggregate.html)
- Improving this README.MD file to provide a great experience
- Updating SUPPORT.MD with content about this project's support experience
- Understanding the security reporting process in SECURITY.MD
- Remove this section from the README
This repository is for active development of the Bing Api SDK for Java.
## Getting started
To get started with a specific service library, see the **README.md** file located in the library's project folder. You can find service libraries in the `/sdk` directory. You can find sdk samples and rest samples in the `/samples` directory. For a list of all the services we support access our [list of all existing libraries]().
For tutorials, samples, quick starts and other documentation, visit [Azure for Java Developers](https://docs.microsoft.com/java/azure/).
## Need help?
- For reference documentation visit the [Azure SDK for Java documentation](https://aka.ms/java-docs).
- For tutorials, samples, quick starts and other documentation, visit `/samples` directory.
- File an issue via [Github Issues](https://github.com/microsoft/bing-search-sdk-for-java/issues).
## Navigating the repository
### Master branch
The master branch has the most recent code with new features and bug fixes.
## Contributing

59
samples/README.md Normal file
Просмотреть файл

@ -0,0 +1,59 @@
---
page_type: sample
languages:
- java
products:
- azure
description: "These samples will get you started using the Java SDKs for various Bing Apis service."
urlFragment: bing-search-sdk-for-java
---
# Bing Apis Java SDK Samples
These samples will get you started using the Java SDKs for various Bing Apis service. They'll cover a few common use cases that are end-to-end solutions, including best practices for interacting with the data from these APIs.
For a general overview about Bing Apis, view [What are Bing Api Services?]().
## Features
This project framework provides examples for the following services:
### Language
* **Spell Check**, using the Bing Spell Check SDK () for the Spell Check API ()
### Search
* **Autosuggest Search**, using the [Bing Autosuggest SDK]() for the [Autosuggest API]()
* **Custom Search**, using the [Bing Custom Search SDK]() for the [Custom Search API v7]()
* **Image Search**, using the [Bing Custom Image Search SDK]() for the [Image Search API v7]()
* **Entity Search**, using the [Bing Entity Search SDK]() for the [Bing Entity Search API]()
* **News Search**, using the [Bing News Search SDK]() for the [News Search v7 API]()
* **Video Search**, using the [Bing Video Search SDK]() for the [Video Search API v7]()
* **Visual Search**, using the [Bing Visual Search SDK]() for the [Bing Visual Search API]()
* **Web Search**, using the [Bing Web Search SDK]() for the [Web Search API v7]()
## Getting Started
### Prerequisites
1. A Bing APIs key and/or endpoint with which to authenticate the SDK's calls. If you don't have an Azure account, you can visit [the Microsoft Web site](https://aka.ms/bingapisignup), create a new Azure account, and try Bing Apis. Or follow the [Create a Bing resource using the Azure portal](https://portal.azure.com/#create/microsoft.bingsearch) guide. You can create an account on the Azure portal through the *Use with an Azure subscription* button.
2. JDK 7 or 8
> Subscription keys are usually per service. For example, the subscription key for Spell Check will not be the same as it is for Custom Search.
### Installation
Copy this repository to your local machine by typing
```
git clone https://github.com/microsoft/bing-search-sdk-for-java.git
```
in your command line/bash. Or download and open the zip file of this repo.
### Quickstart
In each sample you will need your subscription key and/or endpoint from your Azure Portal resource for the service. In the beginning of each sample, add your subscription key/endpoint where applicable.

Просмотреть файл

@ -28,6 +28,7 @@ To get these samples running locally, simply get the pre-requisites above, then:
1. git clone https://github.com/microsoft/bing-search-sdk-for-java.git
2. cd bing-search-sdk-for-java/samples/java/com/microsoft/bing/samples/sdk/AutoSuggestSample
3. set env variable BING_AUTOSUGGEST_SUBSCRIPTION_KEY to your account API key.
4. set env variable `BING_AUTOSUGGEST_ENDPOINT` to your account Endpoint.
5. mvn compile exec:java
## More information ##

Просмотреть файл

@ -29,7 +29,8 @@ To get these samples running locally, simply get the pre-requisites above, then:
2. cd bing-search-sdk-for-java/samples/java/com/microsoft/bing/samples/sdk/CustomSearchSample
3. set env variable BING_CUSTOM_SEARCH_SUBSCRIPTION_KEY to your account API key.
4. set env variable BING_SAMPLES_CUSTOM_CONFIG_ID to your custom configuration id. Can set to 1 if you do not have a custom config id.
5. mvn compile exec:java
5. set env variable `BING_CUSTOM_SEARCH_ENDPOINT` to your account Endpoint.
6. mvn compile exec:java
## More information ##
[Bing Custom Search Documentation](https://docs.microsoft.com/en-us/bing/search-apis/bing-custom-search/overview)

Просмотреть файл

@ -32,7 +32,8 @@ To get these samples running locally, simply get the pre-requisites above, then:
1. git clone https://github.com/microsoft/bing-search-sdk-for-java.git
2. cd bing-search-sdk-for-java/samples/java/com/microsoft/bing/samples/sdk/EntitySearchSample
3. Set a system environment variable named `BING_ENTITY_SEARCH_SUBSCRIPTION_KEY` and add your subscription key value. Reopen your command prompt or IDE. If not, you might get an API key not found exception.
4. mvn compile exec:java
4. set env variable `BING_ENTITY_SEARCH_ENDPOINT` to your account Endpoint.
5. mvn compile exec:java
## More information ##

Просмотреть файл

@ -30,7 +30,8 @@ After getting the prerequisites above:
2. cd bing-search-sdk-for-java/samples/java/com/microsoft/bing/samples/sdk/ImageSearchSample
3. Set a system environment variable named `BING_SEARCH_V7_SUBSCRIPTION_KEY` with your subscription key value,
then reopen your command prompt or IDE. If not, you might get an API key not found exception.
4. mvn compile exec:java-
4. set env variable `BING_SEARCH_V7_ENDPOINT` to your account Endpoint.
5. mvn compile exec:java-
## More information

Просмотреть файл

@ -33,7 +33,8 @@ To get these samples running locally, simply get the pre-requisites above, then:
2. cd bing-search-sdk-for-java/samples/java/com/microsoft/bing/samples/sdk/NewsSearchSample
3. Set a system environment variable named `BING_SEARCH_V7_SUBSCRIPTION_KEY` with your subscription key,
then reopen your command prompt or IDE. If not, you might get an API key not found exception.
4. mvn compile exec:java
4. set env variable `BING_SEARCH_V7_ENDPOINT` to your account Endpoint.
5. mvn compile exec:java
## More information ##
[Bing News Search API Documentation](https://docs.microsoft.com/en-us/bing/search-apis/bing-news-search/)

Просмотреть файл

@ -93,7 +93,7 @@ public class BingSpellCheckSample {
// Authenticate
// Set the BING_SEARCH_V7_SUBSCRIPTION_KEY environment variable with your subscription key,
// then reopen your command prompt or IDE. If not, you may get an API key not found exception.
final String subscriptionKey = System.getenv("AZURE_BING_SAMPLES_API_KEY");
final String subscriptionKey = System.getenv("BING_SAMPLES_API_KEY");
// Add your Bing Search V7 endpoint to your environment variables.
String endpoint = System.getenv("BING_SEARCH_V7_ENDPOINT") + "/v7.0";

Просмотреть файл

@ -18,9 +18,11 @@ This sample checks the spelling for the query "Bill Gatas" (with market and mode
### Clone and run
Execute the following from a command line:
1. `git clone https://github.com/microsoft/bing-search-sdk-for-java.git`
2. `cd bing-search-sdk-for-java/samples/java/com/microsoft/bing/samples/sdk/SpellCheckSample`
1. `mvn compile exec:java cleanupDaemonThreads = false`
1. git clone https://github.com/microsoft/bing-search-sdk-for-java.git
2. cd bing-search-sdk-for-java/samples/java/com/microsoft/bing/samples/sdk/SpellCheckSample
3. Set a system environment variable named `BING_SAMPLES_API_KEY` and add your subscription key value. Reopen your command prompt or IDE. If not, you might get an API key not found exception.
4. set env variable `BING_SEARCH_V7_ENDPOINT` to your account Endpoint.
5. mvn compile exec:java cleanupDaemonThreads = false
## More information

Просмотреть файл

@ -31,7 +31,8 @@ To get these samples running locally, simply get the pre-requisites above, then:
2. cd bing-search-sdk-for-java/samples/java/com/microsoft/bing/samples/sdk/VideoSearchSample
3. Set a system environment variable named `BING_SEARCH_V7_SUBSCRIPTION_KEY` with your subscription key,
then reopen your command prompt or IDE. If not, you might get an API key not found exception.
4. mvn compile exec:java
4. set env variable `BING_SEARCH_V7_ENDPOINT` to your account Endpoint.
5. mvn compile exec:java
## More information ##
[Bing Video Search Documentation](https://docs.microsoft.com/en-us/bing/search-apis/bing-video-search/)

Просмотреть файл

@ -31,7 +31,9 @@ To get these samples running locally, simply get the pre-requisites above, then:
2. cd bing-search-sdk-for-java/samples/java/com/microsoft/bing/samples/sdk/VisualSearchSample
3. Set a system environment variable named `BING_SEARCH_V7_SUBSCRIPTION_KEY` with your subscription key,
then reopen your command prompt or IDE. If not, you might get an API key not found exception.
4. mvn compile exec:java
4. set env variable `BING_SEARCH_V7_ENDPOINT` to your account Endpoint.
5. mvn compile exec:java
## More information ##

Просмотреть файл

@ -29,7 +29,9 @@ To get these samples running locally, simply get the pre-requisites above, then:
2. cd bing-search-sdk-for-java/samples/java/com/microsoft/bing/samples/sdk/WebSearchSample
3. Set a system environment variable named `BING_SEARCH_V7_SUBSCRIPTION_KEY` with your subscription key,
then reopen your command prompt or IDE. If not, you might get an API key not found exception.
4. mvn compile exec:java
4. set env variable `BING_SEARCH_V7_ENDPOINT` to your account Endpoint.
5. mvn compile exec:java
## More information ##