search

package
v0.9.12 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleSearchAPI

func HandleSearchAPI(searcher *FederatedSearch) forge.Handler

HandleSearchAPI returns a handler that serves search results as JSON. GET {base}/api/search?q=...&limit=20

Types

type FederatedSearch

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

FederatedSearch fans out search queries across all SearchableContributor instances and the local content index, then merges and ranks results.

func NewFederatedSearch

func NewFederatedSearch(
	registry *contributor.ContributorRegistry,
	basePath string,
	logger forge.Logger,
) *FederatedSearch

NewFederatedSearch creates a new federated search engine.

func (*FederatedSearch) Index

func (fs *FederatedSearch) Index() *Index

Index returns the local search index for direct access.

func (*FederatedSearch) RebuildIndex

func (fs *FederatedSearch) RebuildIndex()

RebuildIndex rebuilds the local search index from the registry.

func (*FederatedSearch) Search

func (fs *FederatedSearch) Search(ctx context.Context, query string, limit int) []contributor.SearchResult

Search performs a federated search across all providers.

type Index

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

Index provides fast in-memory search over local dashboard content.

func NewIndex

func NewIndex() *Index

NewIndex creates a new search index.

func (*Index) Rebuild

func (idx *Index) Rebuild(registry *contributor.ContributorRegistry, basePath string)

Rebuild rebuilds the index from the registry's current state.

func (*Index) Search

func (idx *Index) Search(query string, limit int) []contributor.SearchResult

Search performs a simple substring match against indexed entries.

type IndexEntry

type IndexEntry struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	URL         string `json:"url"`
	Icon        string `json:"icon"`
	Source      string `json:"source"`
	Category    string `json:"category"` // "page", "widget", "setting"
}

IndexEntry represents a searchable item in the local index.

Jump to

Keyboard shortcuts

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