full-text-search-specialist

Implement GIN-indexed tsvector full-text search for PostgreSQL databases.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/Whaleylaw/llm-lawyer --skill full-text-search-specialist
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: full-text-search-specialist
Source: https://github.com/Whaleylaw/llm-lawyer/tree/main/.claude/skills/full-text-search-specialist
Command: npx skills add https://github.com/Whaleylaw/llm-lawyer --skill full-text-search-specialist

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses slow, imprecise, or unscalable text search in PostgreSQL/Supabase databases by defining indexed search vectors, safe query parsing, and relevance ranking so applications return relevant matches quickly.

Core Features & Use Cases

  • Indexing & Performance: Create tsvector columns or generated columns and GIN indexes to enable fast, scalable text search across large datasets.
  • Relevance & Ranking: Weight fields (title, content, tags), use ts_rank or ts_rank_cd, and apply thresholds to surface the most relevant results.
  • Robust Querying: Safely parse user input with plainto_tsquery or websearch_to_tsquery, support multi-language configurations, fuzzy matching via pg_trgm, autocomplete, and highlight snippets for UI presentation.
  • Operational Patterns: Use triggers or generated columns for auto-updates, partial indexes for filtered sets, EXPLAIN ANALYZE for tuning, and Supabase RPCs/migrations for integration.

Quick Start

Create a tsvector search column from title and content, add a GIN index, populate it with to_tsvector or a trigger/generated column, and run a websearch_to_tsquery query to retrieve ranked results.

Frequently Asked Questions about full-text-search-specialist

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

FAQPage Schema
How do I implement full-text search in PostgreSQL using tsvector and GIN indexes?

To implement full-text search in PostgreSQL, create a generated column or trigger to maintain a tsvector from your target text fields, add a GIN index to that column, and query it using websearch_to_tsquery for fast ranked results.

What is the best way to add fuzzy search and autocomplete to a Supabase database?

The best way to add fuzzy search and autocomplete in Supabase is combining GIN-indexed tsvector fields for standard search with the pg_trgm extension for trigram similarity matching against user input.

How do I rank search results by relevance in PostgreSQL?

Rank search results by applying field weights to title, content, and tags when building your tsvector, then use the ts_rank or ts_rank_cd functions in your ORDER BY clause to sort by relevance.

Should I use plainto_tsquery or websearch_to_tsquery for parsing user search input?

Use websearch_to_tsquery for parsing user search input when you need to support standard search engine syntax like quoted phrases, and use plainto_tsquery when you want to treat all user input as plain literal text without syntax errors.

Can I use PostgreSQL full-text search for large datasets or does it require external search engines?

PostgreSQL full-text search scales effectively for large datasets when you apply GIN indexes to your tsvector columns, often eliminating the need for external search engines by using EXPLAIN ANALYZE to tune query performance.

Why is my PostgreSQL full-text search not returning matches for misspelled words?

Standard full-text search fails for misspelled words because it relies on exact lexeme matching; enable the pg_trgm extension and apply trigram similarity checks to calculate fuzzy matches and resolve typographical errors.