googlesearch

package
v0.14.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxResultsPerPage is the default max number of search results per page
	MaxResultsPerPage = 10
	// MaxResults is the maximum number of search results
	MaxResults = 100
)

Variables

This section is empty.

Functions

func Init

func Init(logger *zap.Logger) base.IConnector

func Min

func Min(x, y int) int

Min returns the smaller of x or y.

func NewService

func NewService(apiKey string) (*customsearch.Service, error)

NewService creates a Google custom search service

Types

type Connector

type Connector struct {
	base.Connector
}

func (*Connector) CreateExecution

func (c *Connector) CreateExecution(defUID uuid.UUID, task string, config *structpb.Struct, logger *zap.Logger) (base.IExecution, error)

func (*Connector) Test

func (c *Connector) Test(defUID uuid.UUID, config *structpb.Struct, logger *zap.Logger) (pipelinePB.Connector_State, error)

type Execution

type Execution struct {
	base.Execution
}

func (*Execution) Execute

func (e *Execution) Execute(inputs []*structpb.Struct) ([]*structpb.Struct, error)

type Result

type Result struct {
	// Title: The title of the search result, in plain text.
	Title string `json:"title"`

	// Link: The full URL to which the search result is pointing, e.g.
	// http://www.example.com/foo/bar.
	Link string `json:"link"`

	// Snippet: The snippet of the search result, in plain text.
	Snippet string `json:"snippet"`

	// LinkText: The scraped text of the search web page result, in plain text.
	LinkText string `json:"link_text"`

	// LinkHTML: The full raw HTML of the search web page result.
	LinkHTML string `json:"link_html"`
}

type SearchInput

type SearchInput struct {
	// Query: The search query.
	Query string `json:"query"`

	// TopK: The number of search results to return.
	TopK *int `json:"top_k,omitempty"`

	// IncludeLinkText: Whether to include the scraped text of the search web page result.
	IncludeLinkText *bool `json:"include_link_text,omitempty"`

	// IncludeLinkHTML: Whether to include the scraped HTML of the search web page result.
	IncludeLinkHTML *bool `json:"include_link_html,omitempty"`
}

SearchInput defines the input of the search task

type SearchOutput

type SearchOutput struct {
	// Results: The search results.
	Results []*Result `json:"results"`
}

SearchOutput defines the output of the search task

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL