feat: places.category_group 분류 컬럼 추가 - #112
Open
labyrinth30 wants to merge 1 commit into
Open
Conversation
카테고리 필터를 조회 시점의 키워드 매칭이 아니라 저장 시점의 분류로 옮긴다. #107은 조회할 때마다 category 문자열에 ilike 14개를 걸고 있는데, 인덱스를 못 타고 키워드 누락이 계속 생기며 분류 규칙을 단위 테스트할 수도 없다. - places.category_group 컬럼(cafe/restaurant/other, default 'other') 추가 - classifyPlaceCategory()로 place upsert 시점에 1회 분류. 카카오는 "음식점 > 카페 > 커피전문점"처럼 계층을 한 문자열로 주기 때문에 카페를 먼저 판정한다 — #107의 "restaurant에서 카페 제외" 규칙과 결과가 같다. - 키워드 목록은 #107에 있던 것을 그대로 옮겨 분류 결과가 달라지지 않게 했다. - 기존 행은 마이그레이션의 UPDATE로 backfill한다. 조회 쿼리 교체는 #107에서 한다. 이 PR은 컬럼과 분류 로직까지만 넣는다. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
labyrinth30
requested review from
KKardy,
minsour and
sudosubin
as code owners
August 30, 2026 14:14
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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.
개요
카테고리 필터를 조회 시점의 키워드 매칭에서 저장 시점의 분류로 옮깁니다.
#107은
category문자열에ilike를 14개 겁니다:문제가 셋입니다.
places전체를 훑습니다.작업 내용
1.
places.category_group컬럼cafe/restaurant/other,varchar(16),NOT NULL DEFAULT 'other'.PLACE_PROVIDERS와 같은 방식(varchar+$type<>())으로 맞췄습니다.2.
classifyPlaceCategory()— 저장 시점 1회 분류place-result.repository.ts의 upsert에서 채웁니다.category가 갱신되면category_group도 함께 갱신되도록onConflictDoUpdate의set에도 넣었습니다.카페를 먼저 판정합니다. 카카오는
"음식점 > 카페 > 커피전문점"처럼 계층 전체를 한 문자열로 주기 때문에 카페도 "음식점"에 걸립니다. 판정 순서가 곧 우선순위이고, 이게 #107의 "restaurant에서 카페 제외" 조건과 결과가 같습니다.키워드 목록(
place.constant.ts)은 #107에 있던 것을 그대로 옮겼습니다. 분류 결과가 달라지지 않게 하려는 의도입니다. 누락 키워드 보강은 별도로 하는 게 리뷰하기 좋다고 봤습니다.3. 기존 행 backfill
마이그레이션에
UPDATE를 넣었습니다. 규칙은 TS 쪽과 동일하게 유지해야 하고, 그 사실을 SQL 주석에 적어뒀습니다.얻는 것
ilike14개 + 부정 조건 2개category_group = ?if블록검증
bun run typecheckbun run checkbun run test:unitbun run test:e2ee2e는
drizzle/의 마이그레이션을 실제로 적용하므로 backfillUPDATE도 함께 검증됩니다.리뷰 포인트
인덱스를 일부러 안 걸었습니다. 값이 3종뿐이라 선택도가 낮아 플래너가 잘 안 씁니다. 이 PR의 이득은 인덱스가 아니라 부분 문자열 매칭 14회를 등호 비교 하나로 바꾸는 데 있습니다. 필요해지면 그때 추가하는 게 낫다고 봤는데, 의견 주시면 넣겠습니다.
분류 규칙이 TS와 마이그레이션 SQL 두 곳에 있습니다. backfill이 일회성이라 감수했습니다. 규칙을 바꾸면 backfill 마이그레이션을 다시 만들어야 하고, 그 내용을 SQL 주석에 남겼습니다.
조회 쿼리는 안 건드렸습니다. 이 PR만 보면 아무도 안 읽는 컬럼이 생기는데, 실제 교체는 #107에서 합니다. 스택을 얇게 쪼개려는 의도입니다.
🤖 Generated with Claude Code