본문으로 건너뛰기

ADR-012 — Natural-language catalog search (Hybrid Retrieval + ABAC)

항목
StatusProposed (2026-05-25 — #992 design step)
Date2026-05-25
DeciderGenD 코어팀 + AI/ML owner
Related Epic#992 (NL Catalog Search, RFP SFR-006)
Related ADRADR-009 (LLM column normalisation — comment 필드를 검색 corpus 에 활용)
Related Issue#990 (Data Map UI — 본 검색의 표현 계층), #994 (Hybrid RAG — 본 검색의 공통 backbone)

한 줄 결정: BM25 (keyword) + Vector (semantic, Weaviate) + Re-ranker (Anthropic Sonnet) 의 hybrid retrieval. ABAC 후처리 필터링 + 검색 결과 캐싱 + 자동완성 / 오타 보정 / 인기 검색어.

결정

1) Retrieval pipeline

2) Indexing pipeline

backfill: 일회성 script (scripts/reindex_catalog_search.py) — 전체 table_metadata row 를 walk.

3) Autocomplete / typo tolerance

  • Autocomplete: prefix-match on table/column/domain 명. Trie + LFU cache (Redis or in-memory).
  • Typo tolerance: Levenshtein distance ≤2 fallback when prefix match 0건. (Trino 명 / 카탈로그 명은 typo tolerance 부담 적음 — limit 2 char.)

4) 인기·추천 검색어

ADR-010 의 search_history 재사용. 동일 workspace 의 24h rolling top 10 + 사용자별 ResourceGroup 의 top 5.

5) ABAC 후처리 시점

candidates merge 후 (단계 ④) — 사전 필터링 시 BM25 / Vector 의 statistical relevance 가 왜곡 (DataGrant 가 없는 row 가 corpus 에서 빠지면 IDF 통계 불균형). 메모리 feedback_abac_column_mask_order 의 정신 — filter 는 검색 직후 단일 단계.

6) Re-rank prompt

[System]
당신은 카탈로그 검색 re-ranker 입니다.
사용자 자연어 질문과 후보 데이터 자산 각각에 대해
0.0~1.0 점수를 매겨주세요. 1.0=완벽 매칭, 0.0=무관.

[User]
질문: {nl_query}
후보:
1. {table_a}: {description_a}
2. {table_b}: {description_b}
...

[Output]
{ "scores": [0.85, 0.42, ...] }

prompt caching: 시스템 prompt + 변하지 않는 candidate 본문은 cache_control ephemeral.

영향

  • 새 API: POST /api/v1/catalog/search (NL query → ranked results), GET /api/v1/catalog/search/autocomplete?q=...
  • Weaviate: 새 class CatalogChunk. UUID5(catalog.schema.table) 로 idempotent upsert.
  • 새 service: catalog_search_service.py (retrieval pipeline orchestration)
  • 새 background job: dagster asset catalog_search_index_refresh (daily full backfill, hourly incremental)
  • Prerequisite: ADR-006 (Ontology — domain semantic enrichment), ADR-009 (column comment corpus), #1018 (Workspace search scope)

비목표

  • multi-modal 검색 (이미지·다이어그램 검색): 본 Phase 비목표.
  • conversational follow-up (전 질문 컨텍스트 유지): 본 Phase 는 단일 query. multi-turn 은 #994 (Hybrid RAG) 또는 별도 ADR.
  • 사용자별 personalisation: 본 Phase 는 workspace + ResourceGroup 단위 추천. user-level RLHF 는 별도.

재검토 트리거

  • BM25 / Vector / Re-ranker 가중치 최적화 — 사용자 클릭률 / dwell time 기반 RLHF.
  • Weaviate latency 한계 → pgvector 또는 self-host alternative 검토.
  • LLM re-rank 비용 한계 → cross-encoder model (BGE-reranker-large 등) self-host 검토.