Commit e376fc9
committed
feat: PostgreSQL 백엔드 — pgvector HNSW + pg_trgm + recursive CTE 그래프 순회
PostgreSQLBackend 구현 (asyncpg 기반):
- pgvector: HNSW 인덱스 벡터 검색 (cosine distance), embedding_dim 설정 가능
- pg_trgm: 한글/영어 fuzzy 매칭 (similarity()), 미설치 시 ILIKE fallback
- FTS: tsvector + plainto_tsquery (simple tokenizer, 한/영 모두 지원)
- 그래프 순회: recursive CTE (N-hop 이웃 탐색, 사이클 방지)
- 하이브리드 검색: FTS + fuzzy + vector 결과 병합 + resonance scoring
- Connection pooling: asyncpg Pool (min=2, max=10)
- Batch: 트랜잭션 내 실행 (rollback on error)
pg_trgm graceful degradation:
- 확장 사용 가능하면 trigram similarity() 사용
- 미설치/충돌 시 ILIKE fallback으로 자동 전환
Integration 테스트: 13개 (CRUD, FTS, fuzzy, vector, hybrid, traversal, prune, decay)
기존 테스트: 93개 유지 (total 106 passed)1 parent 558a135 commit e376fc9
File tree
3 files changed
+645
-10
lines changed- src/synaptic/backends
- tests
3 files changed
+645
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
0 commit comments