Skip to content

[Fix] 대체검색어 오류 수정#146

Merged
marshmallowing merged 1 commit intodevelopfrom
fix/145
Feb 19, 2026
Merged

[Fix] 대체검색어 오류 수정#146
marshmallowing merged 1 commit intodevelopfrom
fix/145

Conversation

@marshmallowing
Copy link
Copy Markdown
Member

@marshmallowing marshmallowing commented Feb 19, 2026

🔍️ 작업 내용

✨ 상세 설명

기존 recommendAlternatives는 Elasticsearch Fuzzy Query 기반으로 동작했는데, Fuzzy Query는 영문 기반이라 한글 처리에서 부정확한 문제 존재

  • 변경 내용
    • ES는 autocomplete 필드 기반 match query로 후보군(50개)만 수집하는 용도로 변경
    • 실제 유사도 판단은 Java LevenshteinDistance로 처리
    • 후보 키워드(brandName, categoryName, name) 전체를 수집 후 편집거리 순으로 정렬하여 상위 N개 반환
    • commons-text:1.12.0 의존성 추가

🛠️ 추후 리팩토링 및 고도화 계획

📸 스크린샷 (선택)

image

💬 리뷰 요구사항

Summary by CodeRabbit

변경 사항

  • 새로운 기능

    • 검색 추천 기능에서 유사도 기반 순위 매김 추가
    • 입력한 검색어와 유사한 대체 검색어 제안
  • 개선 사항

    • 여러 필드를 활용한 더 정확한 검색 결과 추천
    • 사용자 입력과의 유사도에 따른 추천 정렬

@marshmallowing marshmallowing self-assigned this Feb 19, 2026
@marshmallowing marshmallowing added the 🐞 Fix 버그 수정 label Feb 19, 2026
@marshmallowing marshmallowing merged commit 46d2151 into develop Feb 19, 2026
1 check passed
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 19, 2026

Caution

Review failed

The pull request is closed.

전체 요약

PR은 대체 검색어 추천 기능을 개선합니다. Apache Commons Text 라이브러리를 추가하여 Levenshtein 거리 계산을 지원하고, SearchService의 recommendAlternatives 메서드를 리팩토링하여 SearchLogDocument 대신 ProductDocument의 여러 자동완성 필드(brandName, categoryName, name)를 쿼리하도록 변경합니다.

변경 사항

Cohort / File(s) 요약
빌드 설정
build.gradle
유사도 계산용 Apache Commons Text 라이브러리 추가 (v1.12.0)
검색 서비스 리팩토링
src/main/java/com/ongil/backend/domain/search/service/SearchService.java
대체 검색어 추천 메서드 로직 전면 개선: ProductDocument의 다중 자동완성 필드 쿼리, Levenshtein 거리 기반 순위 정렬, 정확한 일치 필터링 추가

상세 분석

주요 변경:

  • 메서드 시그니처: int limitint size (파라미터명 변경)
  • 검색 대상: SearchLogDocument → ProductDocument (데이터 소스 변경)
  • 쿼리 방식: 단일 필드 fuzzy 검색 → 3개 필드(brandName.autocomplete, categoryName.autocomplete, name.autocomplete)에 대한 boolean 쿼리
  • 순위 결정: 새로운 LevenshteinDistance 알고리즘으로 입력 키워드와의 유사도 계산 및 정렬
  • 결과 처리: 다중 필드에서 수집한 후보 문자열 수집, 중복 제거, 대소문자 무시 정확한 일치 제거

🎯 3 (Moderate) | ⏱️ ~20 분

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/145

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 Fix 버그 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] 대체검색어 오류 수정

1 participant