searchsvc

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SearchTypeExamples       = "examples"
	SearchTypeRunbooks       = "runbooks"
	SearchTypeNotebooks      = "notebooks"
	SearchTypeEIPs           = "eips"
	SearchTypeConsensusSpecs = "consensus-specs"
	SearchTypeSpecs          = "specs"

	DefaultSearchLimit    = 3
	MaxExampleSearchLimit = 10
	MaxRunbookSearchLimit = 5
	MaxEIPSearchLimit     = 10
	MaxSpecsSearchLimit   = 10
	MinExampleScore       = 0.3
	MinRunbookScore       = 0.25
	MinEIPScore           = 0.25
	MinSpecsScore         = 0.25
)

Variables

This section is empty.

Functions

func NormalizeSearchType

func NormalizeSearchType(searchType string) (string, error)

NormalizeSearchType validates and normalizes a search type string.

Types

type EIPMetadataProvider added in v0.12.0

type EIPMetadataProvider interface {
	Statuses() []string
	Categories() []string
	Types() []string
}

EIPMetadataProvider provides filter metadata for EIP search.

type EIPSearcher added in v0.12.0

type EIPSearcher interface {
	Search(query string, limit int) ([]resource.EIPSearchResult, error)
}

EIPSearcher provides semantic search over EIPs.

type ExampleSearcher

type ExampleSearcher interface {
	Search(query string, limit int) ([]resource.SearchResult, error)
}

type RunbookSearcher

type RunbookSearcher interface {
	Search(query string, limit int) ([]resource.RunbookSearchResult, error)
}

type RunbookTagProvider

type RunbookTagProvider interface {
	Tags() []string
}

type SearchAllResponse added in v0.18.0

type SearchAllResponse struct {
	Type     string                  `json:"type"`
	Query    string                  `json:"query"`
	Examples *SearchExamplesResponse `json:"examples,omitempty"`
	Runbooks *SearchRunbooksResponse `json:"runbooks,omitempty"`
	EIPs     *SearchEIPsResponse     `json:"eips,omitempty"`
	Specs    *SearchSpecsResponse    `json:"specs,omitempty"`
}

SearchAllResponse is the response for searching across all types.

type SearchConstantResult added in v0.21.0

type SearchConstantResult struct {
	Name            string  `json:"name"`
	Value           string  `json:"value"`
	Fork            string  `json:"fork"`
	SimilarityScore float64 `json:"similarity_score"`
}

SearchConstantResult represents a single spec constant search result.

type SearchEIPResult added in v0.12.0

type SearchEIPResult struct {
	Number          int     `json:"number"`
	Title           string  `json:"title"`
	Description     string  `json:"description"`
	Author          string  `json:"author,omitempty"`
	Status          string  `json:"status"`
	Type            string  `json:"type"`
	Category        string  `json:"category,omitempty"`
	Created         string  `json:"created,omitempty"`
	URL             string  `json:"url"`
	SimilarityScore float64 `json:"similarity_score"`
}

SearchEIPResult represents a single EIP search result.

type SearchEIPsResponse added in v0.12.0

type SearchEIPsResponse struct {
	Type                string             `json:"type"`
	Query               string             `json:"query"`
	StatusFilter        string             `json:"status_filter,omitempty"`
	CategoryFilter      string             `json:"category_filter,omitempty"`
	TypeFilter          string             `json:"type_filter,omitempty"`
	TotalMatches        int                `json:"total_matches"`
	Results             []*SearchEIPResult `json:"results"`
	AvailableStatuses   []string           `json:"available_statuses"`
	AvailableCategories []string           `json:"available_categories"`
	AvailableTypes      []string           `json:"available_types"`
}

SearchEIPsResponse is the response for EIP search.

type SearchExampleResult

type SearchExampleResult struct {
	CategoryKey     string  `json:"category_key"`
	CategoryName    string  `json:"category_name"`
	ExampleName     string  `json:"example_name"`
	Description     string  `json:"description"`
	Query           string  `json:"query"`
	TargetCluster   string  `json:"target_cluster"`
	SimilarityScore float64 `json:"similarity_score"`
}

type SearchExamplesResponse

type SearchExamplesResponse struct {
	Type                string                 `json:"type"`
	Query               string                 `json:"query"`
	CategoryFilter      string                 `json:"category_filter,omitempty"`
	TotalMatches        int                    `json:"total_matches"`
	Results             []*SearchExampleResult `json:"results"`
	AvailableCategories []string               `json:"available_categories"`
}

type SearchRunbookResult

type SearchRunbookResult struct {
	Name            string   `json:"name"`
	Description     string   `json:"description"`
	Tags            []string `json:"tags"`
	Prerequisites   []string `json:"prerequisites"`
	Content         string   `json:"content"`
	FilePath        string   `json:"file_path"`
	SimilarityScore float64  `json:"similarity_score"`
}

type SearchRunbooksResponse

type SearchRunbooksResponse struct {
	Type          string                 `json:"type"`
	Query         string                 `json:"query"`
	TagFilter     string                 `json:"tag_filter,omitempty"`
	TotalMatches  int                    `json:"total_matches"`
	Results       []*SearchRunbookResult `json:"results"`
	AvailableTags []string               `json:"available_tags"`
}

type SearchSpecResult added in v0.21.0

type SearchSpecResult struct {
	Fork            string  `json:"fork"`
	Topic           string  `json:"topic"`
	Title           string  `json:"title"`
	URL             string  `json:"url"`
	SimilarityScore float64 `json:"similarity_score"`
}

SearchSpecResult represents a single consensus spec search result.

type SearchSpecsResponse added in v0.21.0

type SearchSpecsResponse struct {
	Type           string                  `json:"type"`
	Query          string                  `json:"query"`
	ForkFilter     string                  `json:"fork_filter,omitempty"`
	TotalMatches   int                     `json:"total_matches"`
	Specs          []*SearchSpecResult     `json:"specs"`
	Constants      []*SearchConstantResult `json:"constants,omitempty"`
	AvailableForks []string                `json:"available_forks"`
}

SearchSpecsResponse is the response for consensus spec search.

type Service

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

Service provides search across examples, runbooks, EIPs, and consensus specs.

func New

func New(
	exampleIndex ExampleSearcher,
	moduleReg *module.Registry,
	runbookIndex RunbookSearcher,
	runbookReg RunbookTagProvider,
	eipIndex EIPSearcher,
	eipReg EIPMetadataProvider,
	specsIndex SpecsSearcher,
	specsReg SpecsMetadataProvider,
) *Service

New creates a new search service.

func (*Service) SearchAll added in v0.18.0

func (s *Service) SearchAll(query string, limit int) (*SearchAllResponse, error)

SearchAll searches across all available indices and merges results.

func (*Service) SearchEIPs added in v0.12.0

func (s *Service) SearchEIPs(
	query, statusFilter, categoryFilter, typeFilter string,
	limit int,
) (*SearchEIPsResponse, error)

SearchEIPs searches EIPs with optional status, category, and type filters.

func (*Service) SearchExamples

func (s *Service) SearchExamples(query, categoryFilter string, limit int) (*SearchExamplesResponse, error)

func (*Service) SearchRunbooks

func (s *Service) SearchRunbooks(query, tagFilter string, limit int) (*SearchRunbooksResponse, error)

func (*Service) SearchSpecs added in v0.21.0

func (s *Service) SearchSpecs(
	query, forkFilter string,
	limit int,
) (*SearchSpecsResponse, error)

SearchSpecs searches consensus specs with optional fork filter.

type SpecsMetadataProvider added in v0.21.0

type SpecsMetadataProvider interface {
	Forks() []string
}

SpecsMetadataProvider provides filter metadata for consensus spec search.

type SpecsSearcher added in v0.21.0

type SpecsSearcher interface {
	SearchSpecs(query string, limit int) ([]resource.ConsensusSpecSearchResult, error)
	SearchConstants(query string, limit int) []resource.ConstantSearchResult
}

SpecsSearcher provides semantic search over consensus specs.

Jump to

Keyboard shortcuts

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