AI builder who teaches what he ships — new production AI lessons
    All Architectures
    AI SystemsAdvanced

    Hybrid Search (SQL + Vectors)

    Hybrid retrieval: Postgres full-text (tsvector) for exact tokens, pgvector for meaning, business filters in SQL, then a reranker. Redis caches the fused ranking. This is the pattern that beats “vectors only” on SKUs, error codes, and part numbers.

    2K – 100Kusers supported
    $150 – $1,600/month infrastructure

    Architecture Diagram

    Interactive — hover over any node to see its role and description.

    UserSearch UIHybrid APIFTStsvectorpgvectorHNSWFusionRRF / weightedRedisPostgresFiltersUserFrontendAPIDatabaseBackendCache

    Use Cases

    Product search where SKUs and synonyms both matter
    Support search over tickets with IDs and natural language
    Legal or medical corpora needing keyword precision plus semantics
    SaaS in-app search with permission filters
    Reducing hallucinated “no results” on exact model numbers

    Technology Stack

    frontend

    Next.jsReact

    backend

    Python FastAPINode.js

    database

    PostgreSQL + pgvector + tsvectorRedis

    ai

    EmbeddingsCross-encoder rerank

    infrastructure

    RDSElastiCacheDocker

    Scalability Roadmap

    Stage 10 – 5K users· One Postgres

    GIN on tsvector + ivfflat. Fine for hundreds of thousands of rows.

    Stage 25K – 30K users· HNSW + Redis

    HNSW, query cache, async embedding of new rows.

    Stage 330K – 100K users· Replica for search

    Search traffic on a replica. Rerank on a small GPU or API.

    Stage 4100K+ users· Regional replicas

    pgvector + FTS replicas per region. Redis cache per region.

    Cost Breakdown

    Development Cost

    $10,000 – $25,000 (6–12 weeks)

    Infrastructure Cost

    $150 – $1,600/month

    Maintenance Cost

    $1,000 – $3,000/month for ranking evals and synonym lists

    Security Considerations

    Every candidate set filtered by ACL in SQL before fusion
    Reranker sees snippets, not full private documents, when possible
    Query logs sampled and redacted

    More Architectures

    Need This Architecture Built?

    Get a detailed architecture plan, technology recommendations, development roadmap, and infrastructure estimation for your project.