Skip to main content

search-web

ai-research-agent / search/search-web

searchWeb()

function searchWeb(query, options?): Promise<object[]>

Search Web via SearXNG metasearch of all major search engines. Options are 10 search categories, recency, and how many times to retry other domains if first time fails. SearXNG is a free internet metasearch engine which aggregates results from more than 180+ search sources.

Searxng Overview Searxng Installation Guide

Parameters

ParameterTypeDescription

query

string

The search query string.

options?

{ category: string; maxRetries: number; page: number; privateSearxng: string | boolean; proxy: string; recency: number; }

options.category?

string

default=general - ["general", "news", "videos", "images", "science","it", "files", "social+media", "map", "music"]

options.maxRetries?

number

default=3 - Maximum number of retry attempts if the initial search fails.

options.page?

number

default=1 - The page number to retrieve.

options.privateSearxng?

string | boolean

default=null - Use your custom domain SearXNG

options.proxy?

string

default=false - Use corsproxy.io to access in frontend JS

options.recency?

number

default=0 - ["", "day", "week", "month", "year"]

Returns

Promise<object[]>

An array of search result objects.

Example

const advancedResults = await searchWeb('Node.js', {
category: 2,
recency: 1,
maxRetries: 5
});

Author

ai-research-agent (2024) Heiser, M., Tauber, A., Flament, A., et al. (2014-)