# SQLite CJK Full-Text Search (FTS5 trigram)

> Make Chinese search actually work in SQLite — including the silent two-character blind spot.

SQLite CJK Full-Text Search (FTS5 trigram) is a free AI agent skill on Agensi by Drizzt Studio. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Drizzt Studio](https://www.agensi.io/creators/drizztstudio)
- Version: 1.0
- Last updated: 2026-11-18
- Security: scan passed (2026-11-18); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/sqlite-cjk-full-text-search-fts5-trigram
- Tags: sqlite, fts5, cjk, chinese, full-text-search

## About this skill

A methods skill for Chinese/CJK keyword search with SQLite FTS5 `trigram`. It explains why the default tokenizer treats a whole sentence as one token, why queries shorter than three characters return an empty set with no error, and how to fall back to escaped `LIKE` plus safe `MATCH` phrase escaping. Includes copy-paste SQL and Python patterns. Knowledge and code samples only; no bundled executable.

## Known limitations

Trigram matching needs 3+ characters; shorter queries use the LIKE fallback shown in the sample code (slower full scan).
Keyword search only, no semantic/embedding matching.
Index sync is your app's job: same-transaction writes, or all three triggers for external-content tables.
Don't point the index at another framework's live state.db (WAL) or a network-synced SQLite file: extra writers make the original writer refuse to write, and cross-host sharing breaks WAL consistency. Create your own DB.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the SQLite CJK Full-Text Search (FTS5 trigram) skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill fix the common issue of SQLite search not working with CJK languages?

This skill provides SQL schemas and Python logic to implement FTS5 trigram searching, specifically overcoming the "whitespace" limitation that prevents standard SQLite searches from working with Chinese, Japanese, and Korean text.

### What happens if a user searches for a term shorter than three characters?

The skill's sample code routes queries shorter than three characters to a LIKE fallback, so two-character terms return matches instead of silently returning nothing (this is not built-in SQLite behavior).

### What's included?

It's free. The package is a single SKILL.md with explanations and copy-paste SQL/Python snippets; no separate scripts or templates.

### Which frameworks and environments are supported?

This skill is compatible with any environment running SQLite 3 with the FTS5 extension enabled (standard in most Python distributions) and can be integrated into AI agents or applications built with Python's sqlite3 library.

### Why use this instead of asking an AI to write it?

It covers the specific pitfalls: the silent empty result for queries under 3 characters, LIKE wildcard escaping, MATCH quote escaping, and keeping the index in sync after update/delete.

### Does this implementation require an external vector database or API connection?

No, this is a keyword search implementation; it does not require a vector database or an internet connection, making it ideal for local-first apps and privacy-focused tools.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
