Full-Text Search
PostgreSQL native full-text search with tsvector indexing, relevance ranking, search highlighting, suggestions, and analytics.
What's Included#
- PostgreSQL full-text search using to_tsvector and to_tsquery with relevance ranking
- Prisma native search preview using the search filter and _relevance ordering
- Search API route with pagination
- Debounced search input component with URL-based state
- Server-rendered search results page
- GIN index migration for search performance
- Generated tsvector column for pre-computed search vectors
- Search suggestions from tracked popular queries
- Result highlighting with ts_headline
- Advanced search with filters (category, author, date range) and sort options
- Search analytics tracking (query frequency, result counts)
Usage#
Via CLI#
Loading code block...
Via AI Assistant#
Ask your AI assistant:
- "Use the full-text search pattern from Bootspring"
- "Apply the Bootspring full-text search pattern to my project"
Key Considerations#
- Create GIN indexes on search columns; they are essential for full-text search performance
- Use generated tsvector columns to pre-compute search vectors and avoid runtime overhead
- Debounce search input on the client to reduce unnecessary database queries
- Track search queries to understand what users are looking for and identify content gaps
- Require a minimum query length (2-3 characters) before executing searches