Phase 5: Full-Text Search (tsvector)

phase-postgres-5-fulltext-search Phase

Goal: Add full-text search to pal-e-docs using Postgres tsvector. Expose via API and MCP tool. Dramatically reduce token usage for AI queries.
Owner: Dev agent
Repos: pal-e-docs (API + migration), pal-e-docs-mcp (search MCP tool)
Depends on: Phase 3 (Postgres migration) — COMPLETED

Progress

Deliverable Status Details
PR #84: tsvector + search endpoint MERGED tsvector column, GIN index, trigger, <code>GET /notes/search</code>
PR #93: image fix + RollingUpdate + CI commit-back MERGED Correct SHA, zero-downtime deploys, auto image tag updates
PR #19 (pal-e-docs-mcp): search_notes tool MERGED MCP tool wrapping search endpoint
Search API live DONE 10 ranked results for <code>?q=postgres</code>
CI commit-back DONE Woodpecker auto-updates deployment.yaml after build
Benchmark re-test DONE 55% fewer API calls, 71% fewer tokens vs baseline

Acceptance Criteria

  • Search returns ranked results with snippets — VERIFIED
  • search_notes() MCP tool works — VERIFIED
  • tsvector auto-updates on create/update — VERIFIED
  • Deployment uses RollingUpdate — VERIFIED

Key Decisions

  • Postgres trigger for tsvector (always in sync, no app code)
  • Weighted search: title (A) > content (B) > slug (C)
  • Separate /notes/search endpoint (not a filter on list_notes)
  • RollingUpdate over Recreate (SQLite constraint gone with Postgres)
  • CI commit-back for image tags (no manual SHA management)

Token Impact

Before: 12+ MCP calls, ~11K tokens per 5 queries. After: 55% fewer calls, 71% fewer tokens. Validated by benchmark.
  • incident-phase5-deployment-outage-2026-03-06 — outage root cause + timeline
  • concept-argocd-ghost-override — what ghost overrides are and prevention
  • concept-phase5-database-side-intelligence — why intelligence lives in Postgres
  • concept-phase5-self-hosted-rag — Act 2 RAG architecture vision
  • benchmark-phase5-knowledge-baseline — baseline measurements before search