1 pointby varmabudharaju5 hours ago1 comment
  • varmabudharaju5 hours ago
    I had a Postgres database and wanted to add semantic search to it. Quickly realized it's not straightforward — you need to understand pgvector, set up vector columns, HNSW indexes, write triggers for keeping embeddings in sync, build a background worker, and tune queries.

      So I built a small tool called pgsemantic that handles all of that for you.
    
      pip install pgsemantic
      pgsemantic apply --table products --column description
      pgsemantic index --table products
    
      That's basically it. It adds a vector column, creates the index, installs a trigger to keep things in sync, and gives you a worker to process changes.
    
      You can search from the CLI:
      pgsemantic search "lightweight summer jacket" --table products
    
      Or if you use Claude Desktop, it also runs as an MCP server:
      pgsemantic serve
    
      A few things it supports:
      - Local embeddings (sentence-transformers, no API key needed) or OpenAI
      - External storage mode if you don't want to modify your source table
      - Multi-column search (e.g. search across title + description together)
      - Hybrid search with SQL filters
      - Works on RDS, Neon, Supabase, or any Postgres with pgvector
    
    It's open source and MIT licensed. Thought it might be useful for anyone dealing with the same problem. Happy to hear feedback or answer questions.