embedEmail() and searchSimilarEmails() are implemented in ai.service.ts and test-embeddings.ts,
but there is NO way for users to actually use semantic search. The search bar falls back to PostgreSQL
ILIKE pattern matching.
Steps to Reproduce:
- Open frontend inbox
- Type “DBMS project deadline” in search
- Observe: only exact/partial text matches returned, not semantically similar emails
Expected Behavior:
Search should use pgvector cosine similarity to find emails with related meaning even if keywords don’t
match exactly.
Fix Required:
• Expose POST /api/rag/search endpoint
• Add semantic search toggle to frontend search bar
• Ensure pgvector extension is enabled
• Background job to index historical emails
embedEmail() and searchSimilarEmails() are implemented in ai.service.ts and test-embeddings.ts,
but there is NO way for users to actually use semantic search. The search bar falls back to PostgreSQL
ILIKE pattern matching.
Steps to Reproduce:
Expected Behavior:
Search should use pgvector cosine similarity to find emails with related meaning even if keywords don’t
match exactly.
Fix Required:
• Expose POST /api/rag/search endpoint
• Add semantic search toggle to frontend search bar
• Ensure pgvector extension is enabled
• Background job to index historical emails