AgentsSearch

SearchService

View as MarkdownOpen in Claude

SearchService wraps one or more search indexes behind a FastAPI HTTP service with basic authentication, CORS, query caching, and optional HTTPS support. It can serve both SQLite and pgvector backends simultaneously.

1from signalwire.search import SearchService

Requires FastAPI and uvicorn in addition to search dependencies: pip install signalwire[search].

Properties

app
FastAPI | None

The FastAPI application instance. None if FastAPI is not installed.

indexes
dict[str, str]

Mapping of index names to file paths (SQLite) or collection names (pgvector).

search_engines
dict[str, SearchEngine]

Mapping of index names to loaded SearchEngine instances.

backend
str

Storage backend in use. "sqlite" or "pgvector".

port
int

Port the service listens on.

Methods

HTTP Endpoints

When running, the service exposes the following endpoints:

EndpointMethodAuthDescription
/searchPOSTRequiredSubmit a search query. Request body accepts query, index_name, count, similarity_threshold, tags, and language.
/healthGETNoneHealth check. Returns backend type, loaded indexes, and SSL status.
/reload_indexPOSTRequiredReload or add a new index at runtime.