CommSync Runs Text, Vector, and Hybrid Search on Postgres with Lakebase Search
CommSync, a unified SMS/email inbox, runs keyword, semantic and hybrid search entirely in Postgres using Neon's Lakebase Search extensions. lakebase_text provides BM25 search with top-K pushdown over tsvector, and lakebase_vector is a pgvector-compatible drop-in with an ANN index. Warm inbox search went from about 19.5s with cold-start GIN to about 18.6ms. The cmd+k palette fuses lexical and semantic results with weighted RRF (k=60, lexical 1.0, semantic 0.8) in two tiers: a 110ms lexical pass per keystroke and a debounced 420ms hybrid pass. Agent RAG uses exact nearest-neighbor on small per-org knowledge bases, with tenancy and permissions expressed as plain WHERE clauses.
Related posts
- Neon Docs search is now built on Neon
Neon mediumAdept
Neon's docs search now runs entirely on its own stack: Lakebase Postgres with the lakebase_vector (pgvector-compatible ANN) and lakebase_text (BM25) extensions, a Hono API on Neon Functions, and Neon AI Gateway for embeddings and reranking. Pages are ingested as markdown via a GitHub Action, chunked by heading, embedded and stored with tsvectors in one table. To fit search-as-you-type latency budgets, full hybrid results (ANN plus BM25 merged with reciprocal rank fusion, then an LLM rerank) are precomputed for common queries and cached, while unseen queries fall back to BM25 only. Cache hits take 1.9 ms and BM25 misses 8.6 ms at p50 on the server, and top-5 hit rate rose from 80% to 94% on 171 real queries.
- Lakebase Search: the retrieval primitive for agents on Neon
Neon mediumAdept
Lakebase Search adds vector and BM25 search to Lakebase Postgres through two extensions, lakebase_vector and lakebase_text, so agents can query operational data without a separate search system. lakebase_vector keeps its durable index in object storage, caches hot pages in NVMe and RAM, and combines hierarchical IVF with RaBitQ quantization. That design lets compute scale to zero and reconnect without rebuilding the index, and it stays compatible with pgvector types, operators and query syntax. lakebase_text adds a BM25 index over standard tsvector with top-K pushdown, and TypeScript Neon Functions, Object Storage triggers and AI Gateway embeddings round out an ingest-to-hybrid-search pipeline that agents can call in a search-evaluate-retry loop.
- Lakebase Search: vector and BM25 on Neon
Neon mediumAdept
Neon's Lakebase Search adds two Postgres extensions, lakebase_vector (IVF partitioning plus RaBitQ quantization, pgvector-compatible) and lakebase_text (a BM25-native index with Block-Max WAND top-K pushdown), designed for Neon's separated compute and object-storage tiers. HNSW's dependent random reads serialize into tens-of-millisecond round trips on object storage, so the new indexes map clusters and postings to contiguous blocks fetched in parallel. RaBitQ's ~32x compression fits a 100M-vector index in under 10GB versus ~300GB for HNSW, with builds 50–100x faster, and indexes persist on object storage so scale-to-zero and copy-on-write branching work without rebuilds. Hybrid search runs as plain SQL in one transaction, and lakebase_ann_prewarm() is available to avoid cold-cache latency.
- Build an end-to-end RAG pipeline entirely in psql using pgrag and DeepSeek
Neon mediumAdept
pgrag, Neon's open-source Postgres extension, lets you build a complete RAG pipeline inside psql. It provides SQL functions for PDF/DOCX/HTML text extraction, character- or token-based chunking, local CPU embeddings (bge-small-en-v1.5) and reranking (jina-reranker-v1-tiny), plus API calls to OpenAI, Voyage, Anthropic and Fireworks. Paired with pgvector HNSW indexes, a worked example indexes PGConf EU 2023 slides. A single query then retrieves the top 10 chunks, reranks them to 5, and prompts DeepSeek V3, which correctly declines out-of-scope questions. The local models ship as separate ~100MB extensions, and on Neon they need around 2GB RAM of compute.
- Semantic search using OpenAI, pg_embedding and Neon
Neon mediumAdept
A YC idea-matcher app implements semantic search by embedding ~4,400 YCombinator company descriptions with OpenAI's text-embedding-ada-002 (1536 dimensions) and storing them as real[] columns in Neon Postgres via the pg_embedding extension. Queries embed the user's idea and order rows by cosine distance (<=>) to return the top five matches from a Next.js edge function, which is colocated with the database region and uses the Neon serverless driver, Upstash rate limiting and Zod validation. The full ingestion script and API route are shown. Sequential scan is fine for this small dataset, but larger tables need an HNSW index. pg_embedding has since been deprecated in favor of pgvector.