Blocks/Full-Text Search
IntermediateUtility

Full-Text Search

PostgreSQL tsvector search with highlighting

Powerful search on Postgres: generated tsvector columns with GIN indexes, fullTextSearch(), autocomplete(), getFacetCounts(), highlightMatches(), recent searches history, and a debounced useSearch() React hook. Zero external dependencies — uses your existing Supabase instance.

8h
Time saved
327
Lines of code
100%
TypeScript
#search#postgresql#full-text#tsvector

Dependencies

@supabase/supabase-js

Code preview

blocks/search/index.ts
1const { query, setQuery, results, loading } = useSearch({
2 table: 'posts',
3 columns: 'id, title, content',
4 debounceMs: 250,
5})
6var(--text-3);font-style:italic">// results[0].highlight → '…code <b>authentication</b> flow with…'

Short excerpt. Full block includes SQL migrations, error handling, RLS policies, and complete file structure.

$19

One-time · Instant GitHub access

🔜 Payments launching soon

We are setting up secure checkout. Email samarthofficial52@gmail.com to get early access.

You might also like