Sangeetha-Grantha

Metadata Value
Status Completed
Version 2.2.0
Last Updated 2026-09-08
Author Antigravity AI (for Seshadri)
Priority P2 — first new user-facing capability after foundation is sound

TRACK-108: Semantic Search (Gemini Embedding 2 + pgvector)

Implementation & Optimization Completed (2026-09-08): Implemented using Gemini Embedding 2 (models/gemini-embedding-2) with 768-D Matryoshka Representation Learning (MRL) and PostgreSQL 18 pgvector HNSW index. Features hybrid search with Reciprocal Rank Fusion (RRF), section/overview context chunking, backfill CLI, 23-query musicological evaluation benchmark (Recall@5: 91.3%, MRR: 0.773), musical forms taxonomy (R__seed_08_update_musical_forms.sql), iterative HNSW scanning, overview boosting, and React 19 Admin UI hybrid search mode with dynamic relevance scoring. See Implementation Summary and Validation Report.

Goal

Deliver the long-parked “semantic search beyond keyword matching” capability (uplift finding F6; opportunity #5 in 09-ai/integration-opportunities.md) as a shippable v1 — “find similar krithis / search by meaning” over the catalogue — without standing up a separate ML stack or vector database. Embeddings live beside the relational data in the existing PostgreSQL 18 instance via pgvector.

Context

The blocker for this feature used to be infrastructure (an embeddings model + a vector store). Both are now cheap:

This is a new feature, not maintenance — it gets its own track and its own rollout, and it is explicitly not gated on any just-announced model (e.g. Gemini Embedding 2); build on the GA 001 model today.

Architecture / Approach

flowchart TB
  LYR[Krithi sections / lyrics]
  EMB[Gemini Embedding 2<br/>768-d MRL]
  TBL[(pgvector HNSW)]
  Q[Query text]
  ANN[ANN + RRF hybrid]
  EP["POST /v1/search/*"]
  UI[Curator Console]
  LYR --> EMB --> TBL
  Q --> EMB
  TBL --> ANN --> EP --> UI

Design choices:

Implementation Plan

Phase 1 — Schema & infra

Phase 2 — Embedding generation

Phase 3 — Query API

Phase 4 — UI & evaluation

Acceptance Criteria

Risks

Dependencies

Progress Log

Follow-up (separate plan): retrieval evaluator rework

Deferred from the validation remediation by decision on 2026-09-08. Finding 5 of the validation report remains open and is to be planned as its own Intent → Spec → Plan:

Ref: application_documentation/10-implementations/track-108-validation-2026-09-08.md