weave-browser-engine · search
Source declarations, signatures and documentation for search.
Reviewed implementation boundary: The serve path warns but still binds when WEAVE_API_KEY is absent; the authentication check then allows requests. Configure and verify authorization before exposing a server. See /libraries/weave-browser-engine/research-server.
Source: sigil/weave/libs/weave-browser-engine/src/search.rs. SHA-256: 74139c4e4bbf40353655b55881b671c6c965c41c4a2d741074a34ed5b55eda6e.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
search::SearchEngine
A pluggable search engine backend.
Implement this trait to add support for new search providers (Google, Bing, Brave, SearXNG, etc.).
#[async_trait]
pub trait SearchEngine: Send + Sync {
/// The identifier for this engine (e.g. `"duckduckgo"`, `"brave"`).
fn name(&self) -> &str;
/// Run a search query and return up to `top` results.
async fn search(&self, query: &str, top: usize) -> BrowserResult<Value>;
}Source line: 19.
search::DuckDuckGoEngine
DuckDuckGo HTML search — no API key required.
Scrapes the HTML-only endpoint at html.duckduckgo.com/html/.
pub struct DuckDuckGoEngine;Source line: 32.
search::search
Search using the named engine (or default to DuckDuckGo).
This is the top-level convenience function used by dcli and the
HTTP API server. For full control, use a [SearchEngine] impl
directly.
pub async fn search(query: &str, top: usize, engine: &str) -> BrowserResult<Value>;Source line: 109.