Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultHTTPTimeout is the default timeout for HTTP requests. DefaultHTTPTimeout = 30 * time.Second // DefaultMaxResults is the default maximum number of search results. DefaultMaxResults = 10 // DuckDuckGoMaxResults is the maximum number of results for DuckDuckGo. DuckDuckGoMaxResults = 50 // GoogleMaxResults is the maximum number of results for Google CSE API. GoogleMaxResults = 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DuckDuckGoEngine ¶
type DuckDuckGoEngine struct {
// contains filtered or unexported fields
}
DuckDuckGoEngine implements search using DuckDuckGo HTML.
func NewDuckDuckGoEngine ¶
func NewDuckDuckGoEngine() *DuckDuckGoEngine
NewDuckDuckGoEngine creates a new DuckDuckGo search engine.
func (*DuckDuckGoEngine) Search ¶
func (e *DuckDuckGoEngine) Search(ctx context.Context, query string, maxResults int) (*SearchResponse, error)
Search performs a DuckDuckGo HTML search.
type GoogleEngine ¶
type GoogleEngine struct {
// contains filtered or unexported fields
}
GoogleEngine implements search using Google Custom Search API.
func NewGoogleEngine ¶
func NewGoogleEngine(apiKey, cseID string) *GoogleEngine
NewGoogleEngine creates a new Google Custom Search engine.
func (*GoogleEngine) Search ¶
func (e *GoogleEngine) Search(ctx context.Context, query string, maxResults int) (*SearchResponse, error)
Search performs a Google Custom Search.
type SearchEngine ¶
type SearchEngine interface {
Search(ctx context.Context, query string, maxResults int) (*SearchResponse, error)
}
SearchEngine represents a search engine implementation.
func NewSearchEngine ¶
func NewSearchEngine(atmosConfig *schema.AtmosConfiguration) SearchEngine
NewSearchEngine creates a search engine based on configuration.
type SearchResponse ¶
type SearchResponse struct {
Query string `json:"query"`
Results []SearchResult `json:"results"`
Count int `json:"count"`
}
SearchResponse contains search results.
type SearchResult ¶
type SearchResult struct {
Title string `json:"title"`
URL string `json:"url"`
Description string `json:"description"`
}
SearchResult represents a single search result.
Click to show internal directories.
Click to hide internal directories.