GoogleWebSearchService

Wisej.AI.Services.GoogleWebSearchService

Namespace: Wisej.AI.Services

Assembly: Wisej.AI (3.5.0.0)

Represents a web search service using Google's Custom Search API.

public class GoogleWebSearchService : WebSearchServiceBase

This class extends the WebSearchServiceBase to provide functionality for performing web searches using Google's Custom Search API.

Constructors

GoogleWebSearchService(engineID, url)

Initializes a new instance of the GoogleWebSearchService class.

Name
Type
Description

engineID

The unique identifier for the search engine.

url

The base URL for the Google Custom Search API. Default is "https://www.googleapis.com/customsearch/v1".

Properties

Authentication

String: Gets the authentication method for the service. (Default: "api-key")

This property returns null as authentication is handled via API keys in the request URL.

Methods

SearchAsync(query)

Performs an asynchronous web search using the specified query.

Parameter
Type
Description

query

The search query string.

Returns: Task<String>. A task that represents the asynchronous operation. The task result contains the search results as a formatted string.

This method sends a request to the Google Custom Search API and processes the response to extract and format the search results.


var service = new GoogleWebSearchService("your-engine-id");
string results = await service.SearchAsync("example query");
Console.WriteLine(results);

Implements

Name
Description

Represents a service for performing web searches.

Last updated