# ADR 2026-03-31 — Hybrid note search without vector embeddings (NoteLett) ## Status Accepted — implemented in NoteLett backend `POST /notes/search`. ## Context Full semantic search requires embedding models, batch indexing, and higher infra cost. NoteLett needed **ranked search with explainability** (match kind: title, body, tag) for the AI-fast roadmap without blocking on a shared RAG platform. ## Decision 1. **Phase A (shipped):** Implement **lexical + in-process re-ranking** on decrypted note text: - Load candidate notes via existing datastore query (`search` substring filter when query non-empty; recent notes when empty). - Score with token overlap: title > tags > body; multi-word queries use AND semantics. - Return `score`, `matchKind`, and `snippet` for each hit. 2. **Phase B (future):** Optional integration with a **shared embedding / RAG service** or Cosmos vector index when product and cost model allow. The ADR in this doc should be updated to reference the chosen provider and index update path (on note write vs batch). ## Consequences - **Pros:** No new services; works with current Fastify + datastore; explainable results. - **Cons:** Not true semantic similarity; large workspaces may need stricter candidate limits or Phase B. ## Feature flags - `search.hybrid_enabled` — when false, `POST /notes/search` lexical mode only (substring list).