Documentation
¶
Index ¶
- func GetAllEngineInfo(registry *Registry) map[string]EngineInfo
- type AnswerBox
- type Engine
- type EngineInfo
- type ImageResult
- type KnowledgeGraph
- type NewsResult
- type NormalizedSearchResult
- type Normalizer
- func (n *Normalizer) NormalizeImages(result *SearchResult, query string) (*NormalizedSearchResult, error)
- func (n *Normalizer) NormalizeNews(result *SearchResult, query string) (*NormalizedSearchResult, error)
- func (n *Normalizer) NormalizeSearch(result *SearchResult, query string) (*NormalizedSearchResult, error)
- type OrganicResult
- type PeopleAlsoAsk
- type PlaceResult
- type Registry
- type RelatedSearch
- type ScholarResult
- type ScrapeParams
- type SearchMetadata
- type SearchParams
- type SearchResult
- type ShoppingResult
- type VideoResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllEngineInfo ¶
func GetAllEngineInfo(registry *Registry) map[string]EngineInfo
GetAllEngineInfo returns information about all registered engines
Types ¶
type AnswerBox ¶
type AnswerBox struct {
Type string `json:"type,omitempty"`
Title string `json:"title,omitempty"`
Answer string `json:"answer,omitempty"`
Snippet string `json:"snippet,omitempty"`
Source string `json:"source,omitempty"`
Link string `json:"link,omitempty"`
}
AnswerBox represents a featured answer at the top of results
type Engine ¶
type Engine interface {
// GetName returns the name of the search engine
GetName() string
// GetVersion returns the version of the engine implementation
GetVersion() string
// GetSupportedTools returns a list of tool names supported by this engine
GetSupportedTools() []string
// Search performs a general web search
Search(ctx context.Context, params SearchParams) (*SearchResult, error)
// SearchNews performs a news search
SearchNews(ctx context.Context, params SearchParams) (*SearchResult, error)
// SearchImages performs an image search
SearchImages(ctx context.Context, params SearchParams) (*SearchResult, error)
// SearchVideos performs a video search
SearchVideos(ctx context.Context, params SearchParams) (*SearchResult, error)
// SearchPlaces performs a places search
SearchPlaces(ctx context.Context, params SearchParams) (*SearchResult, error)
// SearchMaps performs a maps search
SearchMaps(ctx context.Context, params SearchParams) (*SearchResult, error)
// SearchReviews performs a reviews search
SearchReviews(ctx context.Context, params SearchParams) (*SearchResult, error)
// SearchShopping performs a shopping search
SearchShopping(ctx context.Context, params SearchParams) (*SearchResult, error)
// SearchScholar performs a scholar search
SearchScholar(ctx context.Context, params SearchParams) (*SearchResult, error)
// SearchLens performs a visual search (if supported)
SearchLens(ctx context.Context, params SearchParams) (*SearchResult, error)
// SearchAutocomplete gets search suggestions
SearchAutocomplete(ctx context.Context, params SearchParams) (*SearchResult, error)
// ScrapeWebpage scrapes content from a webpage
ScrapeWebpage(ctx context.Context, params ScrapeParams) (*SearchResult, error)
}
Engine defines the interface that all search engines must implement
func GetDefaultEngine ¶
GetDefaultEngine returns the default engine based on environment variable Falls back to "serper" if SEARCH_ENGINE is not set or the specified engine is not available
type EngineInfo ¶
type EngineInfo struct {
Name string `json:"name"`
Version string `json:"version"`
SupportedTools []string `json:"supported_tools"`
}
GetEngineInfo returns information about an engine
func GetEngineInfo ¶
func GetEngineInfo(engine Engine) EngineInfo
GetEngineInfo returns information about a specific engine
type ImageResult ¶
type ImageResult struct {
Position int `json:"position"`
Title string `json:"title,omitempty"`
ImageURL string `json:"image_url"`
Thumbnail string `json:"thumbnail,omitempty"`
Source string `json:"source,omitempty"`
SourceURL string `json:"source_url,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
IsProduct bool `json:"is_product,omitempty"`
}
ImageResult represents an image search result
type KnowledgeGraph ¶
type KnowledgeGraph struct {
Title string `json:"title,omitempty"`
Type string `json:"type,omitempty"`
Description string `json:"description,omitempty"`
Source string `json:"source,omitempty"`
ImageURL string `json:"image_url,omitempty"`
Attributes map[string]string `json:"attributes,omitempty"`
}
KnowledgeGraph represents a knowledge panel
type NewsResult ¶
type NewsResult struct {
Position int `json:"position"`
Title string `json:"title"`
Link string `json:"link"`
Source string `json:"source"`
Date string `json:"date,omitempty"`
Snippet string `json:"snippet,omitempty"`
ImageURL string `json:"image_url,omitempty"`
Thumbnail string `json:"thumbnail,omitempty"`
}
NewsResult represents a news article result
type NormalizedSearchResult ¶
type NormalizedSearchResult struct {
// Organic search results
OrganicResults []OrganicResult `json:"organic_results,omitempty"`
// Featured content
AnswerBox *AnswerBox `json:"answer_box,omitempty"`
KnowledgeGraph *KnowledgeGraph `json:"knowledge_graph,omitempty"`
// Additional result types
RelatedSearches []RelatedSearch `json:"related_searches,omitempty"`
PeopleAlsoAsk []PeopleAlsoAsk `json:"people_also_ask,omitempty"`
// News-specific (for SearchNews)
NewsResults []NewsResult `json:"news_results,omitempty"`
// Image-specific (for SearchImages)
ImageResults []ImageResult `json:"image_results,omitempty"`
// Video-specific (for SearchVideos)
VideoResults []VideoResult `json:"video_results,omitempty"`
// Places-specific (for SearchPlaces)
PlaceResults []PlaceResult `json:"place_results,omitempty"`
// Shopping-specific (for SearchShopping)
ShoppingResults []ShoppingResult `json:"shopping_results,omitempty"`
// Scholar-specific (for SearchScholar)
ScholarResults []ScholarResult `json:"scholar_results,omitempty"`
// Autocomplete-specific (for SearchAutocomplete)
Suggestions []string `json:"suggestions,omitempty"`
// Metadata
SearchMetadata SearchMetadata `json:"search_metadata"`
// Original response (for debugging or fallback)
Raw *SearchResult `json:"raw,omitempty"`
}
NormalizedSearchResult represents a unified search result structure across all engines
type Normalizer ¶
type Normalizer struct {
// contains filtered or unexported fields
}
Normalizer converts engine-specific responses to normalized format
func NewNormalizer ¶
func NewNormalizer(engineName string) *Normalizer
NewNormalizer creates a new normalizer for the specified engine
func (*Normalizer) NormalizeImages ¶
func (n *Normalizer) NormalizeImages(result *SearchResult, query string) (*NormalizedSearchResult, error)
NormalizeImages normalizes an image search result
func (*Normalizer) NormalizeNews ¶
func (n *Normalizer) NormalizeNews(result *SearchResult, query string) (*NormalizedSearchResult, error)
NormalizeNews normalizes a news search result
func (*Normalizer) NormalizeSearch ¶
func (n *Normalizer) NormalizeSearch(result *SearchResult, query string) (*NormalizedSearchResult, error)
NormalizeSearch normalizes a web search result
type OrganicResult ¶
type OrganicResult struct {
Position int `json:"position"`
Title string `json:"title"`
Link string `json:"link"`
URL string `json:"url"` // Alias for Link
Snippet string `json:"snippet"`
Domain string `json:"domain,omitempty"`
Date string `json:"date,omitempty"`
}
OrganicResult represents a standard web search result
type PeopleAlsoAsk ¶
type PeopleAlsoAsk struct {
Question string `json:"question"`
Answer string `json:"answer,omitempty"`
Title string `json:"title,omitempty"`
Link string `json:"link,omitempty"`
Source string `json:"source,omitempty"`
}
PeopleAlsoAsk represents a "People Also Ask" question
type PlaceResult ¶
type PlaceResult struct {
Position int `json:"position"`
Title string `json:"title"`
PlaceID string `json:"place_id,omitempty"`
DataID string `json:"data_id,omitempty"`
Address string `json:"address,omitempty"`
Phone string `json:"phone,omitempty"`
Website string `json:"website,omitempty"`
Rating float64 `json:"rating,omitempty"`
Reviews int `json:"reviews,omitempty"`
Type string `json:"type,omitempty"`
Hours string `json:"hours,omitempty"`
Price string `json:"price,omitempty"`
Latitude float64 `json:"latitude,omitempty"`
Longitude float64 `json:"longitude,omitempty"`
Thumbnail string `json:"thumbnail,omitempty"`
Attributes map[string]string `json:"attributes,omitempty"`
}
PlaceResult represents a local business or place result
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages available search engines
type RelatedSearch ¶
RelatedSearch represents a related search suggestion
type ScholarResult ¶
type ScholarResult struct {
Position int `json:"position"`
Title string `json:"title"`
Link string `json:"link"`
PublicationURL string `json:"publication_url,omitempty"`
Authors []string `json:"authors,omitempty"`
Year string `json:"year,omitempty"`
Source string `json:"source,omitempty"` // Journal/Conference name
Citations int `json:"citations,omitempty"`
Snippet string `json:"snippet,omitempty"`
PDF string `json:"pdf,omitempty"`
}
ScholarResult represents a scholarly article result
type ScrapeParams ¶
type ScrapeParams struct {
URL string `json:"url" jsonschema:"description:URL to scrape"`
}
ScrapeParams represents parameters for web scraping
type SearchMetadata ¶
type SearchMetadata struct {
Engine string `json:"engine"` // "serper", "serpapi", etc.
Query string `json:"query"`
Location string `json:"location,omitempty"`
Language string `json:"language,omitempty"`
Country string `json:"country,omitempty"`
TotalResults int64 `json:"total_results,omitempty"`
TimeTaken float64 `json:"time_taken,omitempty"` // seconds
}
SearchMetadata contains metadata about the search itself
type SearchParams ¶
type SearchParams struct {
Query string `json:"query" jsonschema:"description:Search query"`
Location string `json:"location,omitempty" jsonschema:"description:Search location"`
Language string `json:"language,omitempty" jsonschema:"description:Search language (e.g., 'en')"`
Country string `json:"country,omitempty" jsonschema:"description:Country code (e.g., 'us')"`
NumResults int `json:"num_results,omitempty" jsonschema:"description:Number of results (1-100),default:10"`
}
SearchParams represents common search parameters across all engines
type SearchResult ¶
type SearchResult struct {
Data interface{} `json:"data"`
Raw string `json:"raw,omitempty"`
}
SearchResult represents a common search result structure
type ShoppingResult ¶
type ShoppingResult struct {
Position int `json:"position"`
Title string `json:"title"`
Link string `json:"link"`
ProductID string `json:"product_id,omitempty"`
Price string `json:"price,omitempty"`
OriginalPrice string `json:"original_price,omitempty"`
Currency string `json:"currency,omitempty"`
Rating float64 `json:"rating,omitempty"`
Reviews int `json:"reviews,omitempty"`
Source string `json:"source,omitempty"`
Delivery string `json:"delivery,omitempty"`
Thumbnail string `json:"thumbnail,omitempty"`
Images []string `json:"images,omitempty"`
InStock bool `json:"in_stock,omitempty"`
}
ShoppingResult represents a shopping/product result
type VideoResult ¶
type VideoResult struct {
Position int `json:"position"`
Title string `json:"title"`
Link string `json:"link"`
Channel string `json:"channel,omitempty"`
Platform string `json:"platform,omitempty"` // e.g., "youtube", "vimeo"
Duration string `json:"duration,omitempty"`
Date string `json:"date,omitempty"`
Views string `json:"views,omitempty"`
Thumbnail string `json:"thumbnail,omitempty"`
Snippet string `json:"snippet,omitempty"`
}
VideoResult represents a video search result
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
mcpserver
command
|
|
|
omniserp
command
|
|
|
examples
|
|
|
capability_check
command
|
|
|
normalized_search
command
|