search

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package search contains the reusable web search core shared by tool wrappers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfiguredProviders

func GetConfiguredProviders() []string

GetConfiguredProviders returns the configured provider names for diagnostics and UI.

func GetProviderMode

func GetProviderMode() string

GetProviderMode returns the current provider mode from environment.

func IsEnabled

func IsEnabled() bool

IsEnabled reports whether any search provider is currently configured.

Types

type Cache

type Cache = webcore.TTLCache[Output]

Cache is a search-specific view over the shared web TTL cache.

func DefaultCache

func DefaultCache() *Cache

DefaultCache returns the default shared cache used for repeated identical search queries.

type Config

type Config struct {
	Cache *Cache
}

Config configures the shared search service.

type HTTPProvider

type HTTPProvider struct {
	// contains filtered or unexported fields
}

HTTPProvider is a configurable HTTP search provider.

func NewHTTPProvider

func NewHTTPProvider() *HTTPProvider

NewHTTPProvider creates a provider from environment configuration.

func (*HTTPProvider) IsConfigured

func (p *HTTPProvider) IsConfigured() bool

func (*HTTPProvider) Name

func (p *HTTPProvider) Name() string

func (*HTTPProvider) Search

type Input

type Input struct {
	Query          string
	AllowedDomains []string
	BlockedDomains []string
}

Input represents a normalized search request for the shared search core.

func (Input) Request

func (i Input) Request() webcore.SearchRequest

Request converts the local search input into the shared request type used across the web stack.

func (*Input) Validate

func (i *Input) Validate() error

Validate enforces the shared constraints used by every search caller.

type Output

type Output = webcore.SearchResponse

Output represents a normalized search response produced by the shared search core.

func FinalizeOutput

func FinalizeOutput(input Input, providerOutput providers.ProviderOutput) Output

FinalizeOutput applies the shared normalization, filtering, dedupe, and ranking used by the core search service so backend callers can stay behaviorally aligned.

func OutputFromProvider

func OutputFromProvider(input Input, output providers.ProviderOutput) Output

OutputFromProvider adapts provider-native hits into the shared search response contract.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service wraps provider discovery and execution behind a stable shared search interface.

func NewService

func NewService() *Service

NewService creates a shared search service using the current environment-driven provider mode.

func NewServiceWithConfig

func NewServiceWithConfig(config *Config) *Service

NewServiceWithConfig creates a shared search service with explicit cache overrides when needed.

func (*Service) ProviderMode

func (s *Service) ProviderMode() string

ProviderMode reports the provider mode selected when the service was constructed.

func (*Service) Search

Search executes the configured provider chain and returns the shared search response contract.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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