searchfed

package
v1.100.3 Latest Latest
Warning

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

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

Documentation

Overview

Package searchfed assembles the universal, topology-free search federation behind one Handle: the knowledge.Router that federates every searchable source a caller can access, and the search toolkit that exposes it as the one discovery entry point (#645).

Unlike the store-owning layers, this layer is a reader/aggregator: it owns no store. Its constructor takes explicit inputs — the searchable source handles/stores (memory store, knowledge insight store, portal knowledge-page/asset/thread stores, prompt store), the semantic.Provider plus a catalog-enabled flag, the *registry.Registry, the shared embedding.Provider, the resolved search-timeout values, and the toolkit instance name — performs the per-source provider selection (each source gated on existing and implementing the relevant searcher interface), builds the DataHub LineageExpander and the knowledge.Router, and constructs the search toolkit. It imports pkg/knowledge, pkg/knowledge/federation, pkg/toolkits/search, pkg/toolkits/knowledge, pkg/semantic, pkg/memory, pkg/portal, pkg/portal/knowledgepage, pkg/prompt, pkg/registry, and pkg/embedding — never pkg/platform. Every federated store is owned by another subsystem and is passed in; the registry, embedding provider, and semantic provider are shared foundations passed in the same way.

The provider count governs registration: with zero providers New returns a nil Handle, so the caller registers no search toolkit and a store-less deployment with no catalog, endpoints, or connections gets no search tool. The layer owns no background goroutine, so it needs no Stop/Close. Toolkit registration stays a caller/registry concern: New builds the toolkit and exposes it via Toolkit() for the caller to register into the shared toolkit registry; consumers read the router through Router().

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// ToolkitName is the search toolkit instance name (the caller passes its
	// default).
	ToolkitName string

	// ProviderTimeout / EmbedTimeout are passed through to the router; 0 keeps
	// the router's built-in defaults.
	ProviderTimeout time.Duration
	EmbedTimeout    time.Duration

	// CatalogEnabled gates the DataHub-backed catalog, context-documents, and
	// lineage-expander sources: they are added only when the configured semantic
	// provider is DataHub (a noop fallback would add an always-empty provider).
	// Combined with a non-nil SemanticProvider.
	CatalogEnabled bool
	// SemanticProvider backs the catalog / context-documents providers and the
	// lineage expander; nil when no real catalog is configured, leaving a plain
	// entity lookup.
	SemanticProvider semantic.Provider

	// Source stores federated into the corpus. Each is gated on being non-nil and
	// implementing the relevant searcher interface, so a source that is absent (or
	// whose implementation is not searchable) contributes no provider.
	MemoryStore        memory.Store
	InsightStore       knowledgekit.InsightStore
	KnowledgePageStore knowledgepage.Store
	AssetStore         portal.AssetStore
	ThreadStore        portal.ThreadStore
	PromptStore        prompt.Store

	// Registry backs the registry-federated sources (API endpoints +
	// connections). Required: New walks it for endpoint searchers and connections
	// even when no store-backed source is present.
	Registry *registry.Registry
	// Embedding powers the router's intent embedding.
	Embedding embedding.Provider
}

Config carries the resolved inputs the owner needs to assemble the search federation. The caller translates its own config and source handles into this shape so this package stays free of the platform's config types.

type Handle

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

Handle owns the assembled search federation: the knowledge.Router and the search toolkit that exposes it. Router() backs both the search tool and any REST consumer; Toolkit() is registered by the caller into the shared toolkit registry. Both are nil on a nil Handle, which New returns when no source is searchable — so a store-less deployment registers no search tool. The layer owns no background goroutine, so there is no Stop/Close.

func New

func New(cfg Config) *Handle

New assembles the router over every searchable source in cfg and builds the search toolkit. It returns nil when no provider is available: with zero providers there is no router and no toolkit to register, preserving the store-less no-op. Otherwise it wires the two search timeouts and logs "search enabled" with the provider count.

func (*Handle) Router

func (h *Handle) Router() *knowledge.Router

Router returns the unified search federation router, or nil on a nil Handle (no searchable source configured). Consumers read it to serve the same grouped, scope-enforced results as the search tool.

func (*Handle) Toolkit

func (h *Handle) Toolkit() *searchkit.Toolkit

Toolkit returns the search toolkit for the caller to register into the shared toolkit registry, or nil on a nil Handle (no searchable source → no search tool).

Jump to

Keyboard shortcuts

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