searxng

package
v3.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SearchClient

type SearchClient struct {
	// SearXNG base URL (should have a trailing /)
	BaseURL   string
	UserAgent string
}

SearXNG client construct this struct manually.

func (*SearchClient) Search

func (s *SearchClient) Search(ctx context.Context, request SearchRequest) (*SearchResponse, error)

func (*SearchClient) SearchPixivNovel

func (s *SearchClient) SearchPixivNovel(ctx context.Context, title string, pageno int) (*SearchResponse, error)

type SearchRequest

type SearchRequest struct {
	Q        string
	Language string
	Pageno   int
}

see https://docs.searxng.org/dev/search_api.html#parameters

func (SearchRequest) Format

func (params SearchRequest) Format(baseURL string) (string, error)

type SearchResponse

type SearchResponse struct {
	Query               string         `json:"query"`
	NumberOfResults     int            `json:"number_of_results"`
	Results             []SearchResult `json:"results"`
	Answers             []any          `json:"answers"`
	Corrections         []any          `json:"corrections"`
	Infoboxes           []any          `json:"infoboxes"`
	Suggestions         []any          `json:"suggestions"`
	UnresponsiveEngines []any          `json:"unresponsive_engines"`
}

type SearchResult

type SearchResult struct {
	URL         string         `json:"url"`
	Title       string         `json:"title"`
	Content     string         `json:"content"`
	Engine      string         `json:"engine"`
	ParsedURL   []string       `json:"parsed_url"`
	Template    string         `json:"template"`
	Engines     []string       `json:"engines"`
	Positions   []int          `json:"positions"`
	Score       float64        `json:"score"`
	Category    string         `json:"category"`
	PublishDate string         `json:"publishedDate,omitempty"`
	Metadata    map[string]any `json:"metadata,omitempty"`
}

Jump to

Keyboard shortcuts

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