Skip to main content

WebSearchServiceBase

Namespace: Wisej.AI.Services

Assembly: Wisej.AI

Represents the base class for web search services, providing common functionality and properties.

public class WebSearchServiceBase : IWebSearchService

This abstract class implements the IWebSearchService interface and provides a foundation for web search services. It includes properties for URL configuration, query string formatting, and authentication handling.

Constructors

WebSearchServiceBase(url)

Initializes a new instance of the WebSearchServiceBase class with the specified URL.

NameTypeDescription
urlStringThe base URL for the web search service.

Throws:

Properties

ApiKey

String: Gets or sets the API key used for authentication. (Default: null)

Authentication

String: Gets the authentication header name. (Default: "api-key")

MaxSites

Int32: Gets or sets the maximum number of sites to search. (Default: 5)

QueryString

String: Gets or sets the query string format. (Default: "q={0}")

Url

String: Gets the base URL for the web search service.

UserAgent

String: Gets or sets the User-Agent header. (Default: "Wisej.AI (by Ice Tea Group LLC)")

Methods

GetApiKey()

Retrieves the API key for the service.

Returns: String. The API key as a string.

If the ApiKey property is not set, this method attempts to retrieve the API key from a centralized store using the service type name.

SearchAsync(query)

Performs an asynchronous search with the specified query.

ParameterTypeDescription
queryStringThe search query string.

Returns: Task<String>. A task representing the asynchronous operation, with a result of the search response as a string.

Inherited By

NameDescription
BingWebSearchServiceRepresents a web search service using Bing's API.
BraveWebSearchServiceRepresents a service for performing web searches using the Brave search engine.
GoogleWebSearchServiceRepresents a web search service using Google's Custom Search API.

Implements

NameDescription
IWebSearchServiceRepresents a service for performing web searches.