# Bing Search

Bing Search provides comprehensive search capabilities powered by the Azure Bing Search API. This versatile tool allows you to search the web, find news articles, discover images, and perform custom searches with various filtering options. Whether you need to gather information, monitor news, find relevant images, or create specialized search experiences, the Bing Search connector offers a complete set of search-related functions without requiring custom code.

### **How to Use Bing Search in ZBrain Flow** <a href="#how-to-use-bing-search-in-zbrain-flow" id="how-to-use-bing-search-in-zbrain-flow"></a>

#### **Step 1: Add Bing Search to Your Flow** <a href="#step-1-add-bing-search-to-your-flow" id="step-1-add-bing-search-to-your-flow"></a>

1. Click the ‘+’ icon in your ZBrain Flow workspace.
2. In the search bar, type “Bing Search”.
3. Select Bing Search from the list of available connections.
4. Choose the action you want to perform from the following options:

| **Action Name**            | **Description**                                                            |
| -------------------------- | -------------------------------------------------------------------------- |
| **Web Search**             | Search the web for general topics, articles, and references.               |
| **Web Search with Offset** | Perform a paginated web search (useful for browsing large result sets).    |
| **General News Search**    | Search for recent news articles from multiple sources.                     |
| **Filtered News Search**   | Filter news based on publication freshness and relevance.                  |
| **News by Category**       | Retrieve news headlines based on predefined topics such as Tech or Health. |
| **Trending News**          | Get the latest trending news by region and category.                       |
| **Custom Image Search**    | Find images using filters like type, size, and orientation.                |
| **Custom Search**          | Execute a highly customized search using Azure Bing Custom Search API.     |

### **How to Create a Bing Search Connection in ZBrain Flow** <a href="#how-to-create-a-bing-search-connection-in-zbrain-flow" id="how-to-create-a-bing-search-connection-in-zbrain-flow"></a>

Before running a Bing Search action, you need to create a secure connection to your Azure Bing Search resource.

1. **Connection Name**: Choose a unique name for your Bing Search connection.
2. **Retrieve Subscription Key**:
   * You can obtain your subscription key by logging into your [Azure Portal](https://portal.azure.com/), navigating to your Bing Search v7 resource, and copying Key 1 or 2 from the Keys and Endpoint section.
3. **Get the Endpoint URL**:
   * The endpoint URL can also be found in your Azure Portal under the same Keys and Endpoint section. It typically looks like:

     `https://<your-region>.api.cognitive.microsoft.com/bing/v7.0/search`
4. **Enter the Details** :
   * Paste the Subscription Key and Endpoint URL into the required fields in the Bing Search connection setup screen.
   * Click ‘Connect’ to authenticate and finalize the connection.

### **Available Actions for Bing Search in ZBrain Flow** <a href="#available-actions-for-bing-search-in-zbrain-flow" id="available-actions-for-bing-search-in-zbrain-flow"></a>

Below is a detailed guide to all Bing Search actions, including required configuration fields for each.

#### **1. Web Search** <a href="#id-1.-web-search" id="id-1.-web-search"></a>

**Configuration Options**:

* **Connection**: Select your existing Bing Search connection or create a new one.
* **Search Query**: Enter the keyword(s) or phrases you wish to search.
* **Market**: Choose the region and language context (e.g., `en-US`, `fr-FR`) to localize search results.
* **Count**: Specify the number of results to return (default: 10; max: 50).

#### **2. Web Search with Offset** <a href="#id-2.-web-search-with-offset" id="id-2.-web-search-with-offset"></a>

**Configuration Options**:

* **Connection**: Choose or establish a Bing Search connection.
* **Search Query**: Input the keyword(s) or phrase to search.
* **Market**: Specify the locale to refine search relevance.
* **Count**: Set the number of results to retrieve (default: 10).
* **Offset**: Enter the index number to start returning results from (default: 0). Useful for fetching pages beyond the first.

#### **3. General News Search** <a href="#id-3.-general-news-search" id="id-3.-general-news-search"></a>

**Configuration Options**:

* **Connection**: Use an existing connection or create a new one.
* **Search Query**: Specify the news topic or keywords.
* **Market**: Select the region to localize the news feed.
* **Count**: Number of articles to return (default: 10; max: 50).

#### 4. Filtered News Search <a href="#id-4.-filtered-news-search" id="id-4.-filtered-news-search"></a>

**Configuration Options**:

* **Connection**: Connect to or set up a Bing Search integration.
* **Search Query**: Define the specific news topic.
* **Market**: Choose the region/language locale for results.
* **Freshness**: Filter news by publication timeframe:
  * `Day`: Past 24 hours
  * `Week`: Past 7 days
  * `Month`: Past 30 days
* **Sort By**: Organize results by:
  * `Date`: Newest articles first
  * `Relevance`: Most contextually relevant articles

#### **5. News by Category** <a href="#id-5.-news-by-category" id="id-5.-news-by-category"></a>

**Configuration Options**:

* **Connection**: Use an active Bing Search connection or configure a new one.
* **News Category**: Specify the category to filter news content.
* **Market**: Define the locale for region-specific headlines.
* **Safe Search**: Control sensitivity of content:
  * `Strict`
  * `Moderate`
  * `Off`

#### **6. Trending News** <a href="#id-6.-trending-news" id="id-6.-trending-news"></a>

**Configuration Options**:

* **Connection**: Choose or create a Bing Search connection.
* **Market**: Select a regional market to fetch localized trending stories (e.g., `en-US`, `de-DE`, `en-IN`).

#### **7. Custom Image Search** <a href="#id-7.-custom-image-search" id="id-7.-custom-image-search"></a>

**Configuration Options**:

* **Connection**: Use an existing or new Bing Search connection.
* **Function Type**: Choose the function type from the available options.
  * `Image Search`: Search by keyword or topic
  * `Trending Images`: View currently trending images
  * `Query-based Search`: Perform query-specific searches
* **Search Query**: Define the visual content you're looking for.
* **Image Type**: Choose the type of image:
  * `Photo`, `Clipart`, `Line`, `AnimatedGif`, `Shopping`
* **Aspect Ratio**: Set image shape preferences:
  * `Square`, `Wide`, `Tall`

#### **8. Custom Search** <a href="#id-8.-custom-search" id="id-8.-custom-search"></a>

**Configuration Options**:

* **Connection**: Select or establish a Bing Search connection.
* **Search Type**: Select the search type from the available options:
  * `Web Search`
  * `Image Search`
  * `Custom Query Search`
  * `Custom Image Query Search`
* **Search Query**: Define your search input.
* **Custom Config ID**: Enter your Custom Configuration ID (usually `1`, found in Azure Custom Search resource).
* **Market**: Localize the results with your region setting.
* **Count**: Specify the number of results to return.
* **Offset**: Enable pagination by selecting a starting index.
* **Safe Search**: Filter explicit content using:
  * `Strict`, `Moderate`, or `Off`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zbrain.ai/zbrain-documentation/zbrain-builder/flows/flow-components/bing-search.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
