SongGuess
    Preparing search index...

    Cloudflare Web Search binding.

    Discovery-only primitive for agents and Workers. Returns URLs and catalog metadata for a query; never returns page content or excerpts. To read a result's body, fetch the URL with the global fetch() API.

    Declared in wrangler with a single object (there is exactly one corpus, the public web, so there is no name, namespace, or instance to specify):

    { "web_search": { "binding": "WEBSEARCH" } }
    
    const { items, metadata } = await env.WEBSEARCH.search({
    query: "Cloudflare Workers",
    });

    const top = items[0];
    console.log(top.url, top.title, metadata.latencyMs);

    // Read content yourself; pay-per-crawl and other publisher
    // controls apply at the fetch site, not at search time.
    const page = await fetch(top.url);
    Index

    Constructors

    Methods

    Constructors

    Methods