searchruntime

package
v0.1.0-round1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package searchruntime exposes the deep WAS search module used by MCP.

It deliberately hides PostgreSQL, profile, and vector-engine construction so the MCP repository depends on one stable interface instead of WAS internals.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidArgument reports an invalid search request or runtime configuration.
	ErrInvalidArgument = knowledge.ErrInvalidArgument
	// ErrProfileMismatch reports an incompatible processing or vector profile.
	ErrProfileMismatch = knowledge.ErrProfileMismatch
	// ErrTemporarilyUnavailable reports a retryable search dependency failure.
	ErrTemporarilyUnavailable = knowledge.ErrTemporarilyUnavailable
)

Functions

func IsRetryable

func IsRetryable(err error) bool

IsRetryable reports whether err represents a dependency outage safe to retry.

Types

type Config

type Config struct {
	DatabaseURL        string
	ModelPath          string
	TokenizerPath      string
	RuntimeLibraryPath string
	PublicBaseURL      string
	MinimumScore       float64
	// OriginalRoot enables citation-integrity verification for grounded search.
	// It is optional for source compatibility; when omitted, grounded hits fail
	// closed as SOURCE_UNAVAILABLE while the legacy Documents method still works.
	OriginalRoot string
}

Config contains the process-owned dependencies needed by the MCP search runtime. MinimumScore defaults to 0.62 when zero.

type Hit

type Hit struct {
	Rank            int
	Score           float64
	DocumentID      string
	DocumentName    string
	VersionID       string
	DocumentVersion int
	PageNumber      int
	Snippet         string
	SourceURL       string
}

Hit is one ranked, page-grounded result from the active document version.

type Runtime

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

Runtime owns the database pool, pinned vector engine, and search module.

func Open

func Open(ctx context.Context, runtimeConfig Config) (*Runtime, error)

Open validates the immutable processing profile and opens the MCP search runtime.

func (*Runtime) Close

func (r *Runtime) Close() error

Close releases the vector runtime and database pool. It is safe to call repeatedly.

func (*Runtime) Documents

func (r *Runtime) Documents(ctx context.Context, query string, limit int) ([]Hit, error)

Documents validates, embeds, and searches only active document versions.

func (*Runtime) GroundedDocuments

func (r *Runtime) GroundedDocuments(
	ctx context.Context,
	query string,
	limit int,
) ([]Hit, string, string, error)

GroundedDocuments adds the deterministic grounding decision used by MCP and browser clients without changing the legacy Documents method.

func (*Runtime) Ready

func (r *Runtime) Ready(ctx context.Context) error

Ready verifies the database profile and local query embedder without mutation.

Jump to

Keyboard shortcuts

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