Skip to content

Hybrid Search

Postgram blends lexical and semantic retrieval so queries can match both exact terms and semantic intent.

This page explains the default ranking model, what happens when embeddings are unavailable, and practical search options for humans and agents.

  1. Call search via REST:
Terminal window
curl -X POST http://127.0.0.1:3100/api/search \
-H "Authorization: Bearer $PGM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"private knowledge graph", "limit":20}'
  1. Or use CLI with optional filters:
Terminal window
pgm search "private knowledge graph" --type=memory --limit 20
  1. Inspect edge summaries in compact results. Search output may include edges.count and edges.relations when matching entities have graph connections.

  2. Expand graph context only when the user’s question needs connected context:

Terminal window
pgm search "pgvector" --expand-graph
  1. For agent UIs, request compact output (--toon) or compact JSON when chaining results.
  • Default blend is 60% vector and 40% BM25, with recency-aware score adjustments.
  • Search requires a reachable embedding provider. Writes can still succeed when it is unavailable, but enrichment and search fail until the provider recovers.
  • API responses include ranked results plus optional chunk text, similarity, and final score.
  • Compact search results may include edge counts and relation labels without neighbor content. Treat them as traversal hints, not as graph expansion.
  • Use graph expansion for causes, provenance, decisions, dependencies, blockers, ownership, involvement, related discussions, or ambiguous search hits. Skip it for direct facts already present in the search result.