검색 기능 버전업 - #132
Merged
Merged
Conversation
joona95
commented
Aug 1, 2026
Collaborator
- 블로그 레시피 중복 저장 오류 수정
- 검색어 일치율 우선 적용 및 제목 매칭 우선 적용
- 블로그 썸네일 크롤링 동기 및 병렬 처리
기존 정렬(scraps/views/newest)이 MATCH AGAINST 를 필터로만 쓰고 일치율은 정렬에 반영하지 않아, '간장국수' 검색 시 간장게장 등 덜 일치하는 결과가 최신순/인기순으로 위에 노출되던 문제를 해결. - 정렬 순서를 '검색어 일치율(relevance) 대분류 → 기존 정렬키 소분류 → id' 로 변경 - QueryUtils.relevanceScore 로 MySQL FULLTEXT BOOLEAN MODE 점수를 ORDER BY 에 재사용 (WHERE 필터의 MATCH 와 동일식이라 추가 스캔 없음) - 커서(keyset) 페이징 유지: (일치율, 기존키, recipeId) 복합 커서를 lastRecipeId 로 도출 → 프론트 변경 불필요 - 1글자(ExactToken) 검색은 점수가 없어 기존 순수 정렬로 폴백 - recipe/blog/youtube 3개 모듈 동일 패턴 적용 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
일치율 정렬이 title+description 을 합친 searchTokens 하나로만 점수를 매겨 '제목에서 맞았는지 내용에서 맞았는지' 구분하지 못하던 것을 개선. 제목에서 맞은 결과가 내용에서만 맞은 결과보다 항상 위로 오도록 한다. - 엔티티에 titleSearchTokens 컬럼 추가(제목만 nori 토큰화, @PrePersist) Recipe(recipeNm) / BlogRecipe(title) / YoutubeRecipe(title) - QueryUtils.titlePriorityScore = MATCH(titleSearchTokens)×1,000,000 + MATCH(searchTokens) → 제목 매칭이 압도적 가중치를 가져 자동으로 '제목 그룹 먼저' 계층 형성 - recipe/blog/youtube 3개 정렬 점수식을 titlePriorityScore 로 교체 (커서 구조는 그대로) - SearchTokensBackfillRunner 를 targetColumn 파라미터화 + titleSearchTokens 백필 추가 (RecipeIngredient 는 제목 개념 없어 제외) 배포 시: titleSearchTokens 컬럼+FULLTEXT 인덱스 추가 → 앱 배포 → 백필 순서 필수. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
기존 제목 점수가 OR + 단어빈도(TF) 기반이라, '간장국수' 검색 시 제목에 '국수'를 여러 번 반복한 초계국수 글이 '간장'+'국수'를 각각 한 번씩 맞춘 간장국수 글보다 점수가 높게 나오는 문제가 있었다. (TF 합산은 검색어 커버리지를 보상하지 않음) - titlePriorityScore 의 제목 점수를 MATCH(title, '+간장 +국수') 형태(AND)로 변경 → 제목에 모든 검색어를 포함한 글만 상위 계층으로 올라온다 - 전체(searchTokens) 점수는 OR 유지 → recall 보존(일부만 맞은 글도 결과엔 남음) - toRequiredForm: 2글자 이상 토큰만 '+' 부여, 1글자 토큰은 FULLTEXT 인덱싱 불가라 제외 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.