ADR 0006 — Hybrid search with deterministic fallback
Keyword relevance = IDF-weighted query-term coverage (absolute, comparable across queries), refined by
PostgreSQL ts_rank_cd (or BM25 on SQLite). Semantic similarity = pgvector cosine when the extension exists,
otherwise in-process cosine. Ranking includes quality and an entity-type prior but never revenue.
Update (2026-11): the default provider is OpenAI text-embedding-3-small shortened to 256 dimensions (the
pgvector column size). The search index holds compact metadata only, so cost is negligible (cents per full
reindex); quality, latency and serverless fit decided the choice. Deterministic feature hashing remains the
fallback when no API key is configured or the provider fails. Every vector records the model that produced it;
search compares only vectors from the same model, and refresh_embeddings re-embeds fallback/out-of-date vectors.