Documentation
¶
Overview ¶
Package searchsystem implements the capability layer of the research stack. It discovers public sources and retrieves bounded page content, but it does not decide whether evidence is sufficient or compose a user-facing answer.
Index ¶
- Variables
- type DefaultExtractor
- type Document
- type Extractor
- type Fetcher
- type Hit
- type Observation
- type Provider
- func NewArxivProvider(client *http.Client, baseURL string) Provider
- func NewGDELTProvider(client *http.Client, baseURL string) Provider
- func NewGitHubProvider(client *http.Client, baseURL, token string) Provider
- func NewWikipediaProvider(client *http.Client, baseURL string) Provider
- func WithResilience(provider Provider, config ResilienceConfig) Provider
- type ProviderConfig
- type ProviderError
- type Query
- type ResilienceConfig
- type RoundResult
- type Router
- type SourceKind
- type SourceRouter
- type System
Constants ¶
This section is empty.
Variables ¶
var ErrProviderCircuitOpen = errors.New("provider circuit is open")
Functions ¶
This section is empty.
Types ¶
type DefaultExtractor ¶
type DefaultExtractor struct{ MaxContentChars int }
func (DefaultExtractor) Extract ¶
func (e DefaultExtractor) Extract(document Document) Document
type Document ¶
type Document struct {
Hit
CanonicalURL string
Content string
ContentHash string
FetchedAt time.Time
}
Document is normalized content returned by the fetch and extraction stages.
type Extractor ¶
Extractor bounds and normalizes fetched content before it leaves the capability layer.
type Hit ¶
type Hit struct {
QueryID string
Provider string
Kind SourceKind
Title string
URL string
Snippet string
Priority int
Seed bool
SearchRank int
ProviderRank int
PublishedAt time.Time
}
Hit is a lightweight search result. Page content is fetched only after the complete result set has been deduplicated and prioritized.
type Observation ¶
type Observation struct {
Operation string
Target string
Provider string
Status string
ErrorCode string
Summary string
ElapsedMS int64
}
Observation records one bounded capability operation without retaining raw provider payloads.
type Provider ¶
type Provider interface {
Name() string
Kind() SourceKind
Search(context.Context, Query, int) ([]Hit, error)
}
Provider is an independently replaceable search backend.
func NewGitHubProvider ¶
func WithResilience ¶
func WithResilience(provider Provider, config ResilienceConfig) Provider
type ProviderConfig ¶
type ProviderConfig struct {
Enabled []string
GitHubToken string
Resilience ResilienceConfig
}
func DefaultProviderConfig ¶
func DefaultProviderConfig() ProviderConfig
type ProviderError ¶
func (*ProviderError) Error ¶
func (e *ProviderError) Error() string
type Query ¶
type Query struct {
ID string
Text string
Purpose string
Priority int
PreferredSource []SourceKind
}
Query is a provider-independent search request produced by the decision layer.
type ResilienceConfig ¶
type ResilienceConfig struct {
Timeout time.Duration
FailureThreshold int
OpenDuration time.Duration
}
func DefaultResilienceConfig ¶
func DefaultResilienceConfig() ResilienceConfig
type RoundResult ¶
type RoundResult struct {
Hits []Hit
Documents []Document
Observations []Observation
Failures []string
}
RoundResult contains only capability-layer facts; evidence quality is added by the evidence layer.
type SourceKind ¶
type SourceKind string
SourceKind describes the type of source a query should prioritize.
const ( SourceGeneral SourceKind = "general" SourceOfficial SourceKind = "official" SourceGitHub SourceKind = "github" SourceAcademic SourceKind = "academic" SourceNews SourceKind = "news" SourceVideo SourceKind = "video" )
type SourceRouter ¶
SourceRouter chooses providers from explicit source preferences.
type System ¶
type System struct {
// contains filtered or unexported fields
}
func NewDefault ¶
func NewDefault() *System
func NewDefaultWithConfig ¶
func NewDefaultWithConfig(config ProviderConfig) *System
NewDefaultWithConfig builds a registry of genuinely independent source providers plus scoped public-web fallbacks.
func (*System) ExecuteRound ¶
func (s *System) ExecuteRound(ctx context.Context, queries []Query, seedURLs []string, maxSearches, resultsPerSearch, maxPages int) (RoundResult, error)
ExecuteRound searches first, then fetches only the highest-value unique URLs.