Documentation
¶
Overview ¶
Package serper wires Serper's Google Search API into web.Searcher.
Requests use POST /search with the X-API-KEY header and always enable autocorrect.
web.SearchRequest maps to the Serper request:
- Query → q, with domain filters rewritten by web.SearchRequest.QueryWithSiteOperators
- MaxResults → num (omitted when unset)
- Recency → tbs=qdr:h|d|w|m|y
Only organic[] results are surfaced: title → Title, link → URL, snippet → Snippet, and date → PublishedTime when it is an absolute date.
Reference: https://serper.dev/playground
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Search ¶
func (c *Client) Search(ctx context.Context, request *web.SearchRequest) (*web.SearchResponse, error)
type Config ¶
type Config struct {
APIKey string
BaseURL string
// HTTPClient remains host-owned. Requests and redirects are restricted to
// BaseURL's origin, including when the host redirect policy changes a request.
HTTPClient *http.Client
}
Config configures a Client. APIKey is required; an empty BaseURL selects Serper's public endpoint and a nil HTTPClient selects a default client.
Click to show internal directories.
Click to hide internal directories.