Conversation
LocalDocumentIndexingE2ETest가 pgvector 질의 결과에 제빵 DOCX도 포함되어야 한다고 단정해 실패하고 있었다. 검색 결함이 아니라 최소 유사도 정책 도입 이전에 작성된 기대값이 그대로 남은 것이다. DOCX는 검색 SQL의 WHERE 조건을 모두 통과하며, 탈락 지점은 VectorSearchQueryService의 최소 유사도 필터다. 실측 유사도는 PDF가 0.8272와 0.4262, DOCX가 0.2218로 임계값 0.30에 미달한다. 질의가 pgvector HNSW를 묻고 DOCX 본문은 제빵 절차라 관련이 없으므로 제외가 정상 동작이다. 무관한 문서가 제외되는지와, 같은 DOCX가 관련 질의에는 검색되는지를 함께 단정하도록 바꿨다. 한 질의만 보면 문서가 빠진 이유가 관련성 판정인지 인덱싱 누락인지 구분할 수 없어서다. SEARCH_VECTOR_MIN_SIMILARITY을 0.0으로 낮춰 가드레일을 무력화하면 이 테스트만 실패하는 것을 확인했다.
|
Important Review available on request
Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 배경
LocalDocumentIndexingE2ETest가 develop 기준으로 실패하고 있었습니다. 의미 검색 결과에 DOCX 문서가 없어anyMatch단정이 깨집니다.조사 결과 검색 결함이 아니라, 정책 변경을 따라가지 못한 테스트였습니다. 이슈 최초 작성 시 의심했던
embedding_model_id불일치나is_searchable다중 행은 둘 다 아니었습니다.🔍 원인
DOCX는 검색 SQL의 WHERE 조건을 모두 통과합니다. 조건을 단계별로 분해해 확인했습니다.
탈락 지점은 SQL이 아니라
VectorSearchQueryService.selectCandidates의 최소 유사도 필터였습니다.원시 유사도 실측값입니다.
테스트 픽스처를 보면 당연한 결과입니다.
How does pgvector HNSW improve cosine similarity search for embeddings?Flour water yeast and salt are combined before dough fermentation and oven baking.제빵 문서라 pgvector 질의와 무관합니다. 유사도 0.2218은 정상이고 가드레일이 이를 제거하는 것도 의도된 동작입니다. 이 테스트는 최소 유사도 정책(#190·#192·#197·#199·#201) 도입 이전에 작성돼, "의미적으로 무관한 문서도 검색 결과에 나와야 한다" 고 단정하고 있었습니다.
🔧 변경 내용
기대값만 바꾸지 않고, 정책을 검증하는 테스트로 재작성했습니다.
두 번째 질의가 핵심입니다. 한 질의만 보면 문서가 빠진 이유가 관련성 판정 때문인지 인덱싱 누락 때문인지 구분할 수 없습니다. 두 질의를 함께 확인해야 "관련 없어서 제외됐다"가 증명됩니다.
Vector 차원·유한성 검증은 기존과 동일하게 유지하고 질의별 헬퍼로 분리했습니다.
✅ 검증
./gradlew -p backend localE2eTest --tests "*LocalDocumentIndexingE2ETest*"통과SEARCH_VECTOR_MIN_SIMILARITY=0.0으로 가드레일을 무력화하면 이 단정만 정확히 실패합니다. 테스트가 실제로 정책을 지키고 있음을 확인했습니다.📎 참고
local-e2e태그가 기본test태스크에서 제외돼 있어./gradlew test로는 실행되지 않습니다. 이 테스트를 상시 검증하려면 CI 구성이 별도로 필요합니다.closes #233