full-text-search

Implements product full-text search across PostgreSQL and Elasticsearch backends with sync and reindexing.

Updated Jan 27, 2026
One-click install
npx skills add https://github.com/SmallAi-API/smaihub --skill full-text-search-smallai-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: full-text-search
Source: https://github.com/SmallAi-API/smaihub/tree/main/.agents/skills/full-text-search
Command: npx skills add https://github.com/SmallAi-API/smaihub --skill full-text-search-smallai-api

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? It guides engineers through implementing and operating full-text search over product data (agents, topics, messages, files, knowledge bases) across pg_search, pg_like, and Elasticsearch providers while preserving permission boundaries and stable result contracts. ## Core Features & Use Cases - Provider-neutral search architecture: Routes all queries through FtsSearchRepo with deployment-level provider selection, keeping result shapes and permission hydration stable. - Elasticsearch mapping migrations: Manages index generations, schema fingerprints, checkpoints, promotion, rollback, and in-place additive upgrades. - Outbox-based sync and reindexing: Covers durable change capture, claims, retries, dead letters, resumable backfills, and continuous incremental draining. - Use Case: When adding a new searchable entity, follow the cross-layer checklist to update document schemas, mappings, builders, capture triggers, and reindex checkpoints consistently. ## Quick Start Ask the assistant to add a new searchable entity to the full-text search system and update the mappings, builders, and sync infrastructure accordingly.

Frequently Asked Questions about full-text-search

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new searchable entity to full-text search?

Treat it as one cross-layer change: update FTS_SEARCH_DOCUMENT_ENTITIES and shared types, the document schema and mappings, the FtsSearchDocumentBuilder, both PostgreSQL and Elasticsearch backends, capture triggers, and reindex checkpoints. Schema fields, mappings, builders, and fixtures must agree exactly.

pg_search vs Elasticsearch vs pg_like for product search?

pg_like serves individual users with small datasets as a lightweight explicitly selected provider. pg_search and Elasticsearch cover richer search quality and larger datasets. FTS_SEARCH_PROVIDER selects one at deployment level; it is not a feature flag or automatic fallback.

How do Elasticsearch mapping migrations work with schema versions?

Each entity declares a schemaVersion whose fingerprint is a sha256 of the mapping plus shared analysis. Changed entities get a new migration batch with bumped versions, are backfilled into a new index generation beside the live alias, and are promoted only after the Outbox is idle.

Can Elasticsearch results be returned directly to routers?

No. When Elasticsearch only supplies candidate IDs, PostgreSQL hydration and parent checks remain the authoritative permission boundary. Providers must return the existing hydrated response types, and routers must never see provider-specific result shapes.

Why does the reindex command retain a namespace lock after failing?

A failed mutating command keeps its non-expiring Elasticsearch namespace lock when its outcome may be uncertain. Before releasing it with --release-lock, stop the previous process and resolve pending requests; never assume lock age proves the process stopped.

When should I use --in-place mapping upgrades?

Use --in-place only when status reports upgrade_available with mappingChange: additive, meaning new top-level fields. It widens the live index with PUT _mapping and backfills with external_gte, but offers no old-generation alias rollback.