Skip to content

[Refactor] 채용공고 추출 검색 변경 (#27)#60

Merged
shinae1023 merged 1 commit into
mainfrom
fix/#38-job-extract
May 22, 2026
Merged

[Refactor] 채용공고 추출 검색 변경 (#27)#60
shinae1023 merged 1 commit into
mainfrom
fix/#38-job-extract

Conversation

@shinae1023
Copy link
Copy Markdown
Member

@shinae1023 shinae1023 commented May 22, 2026

✨ 어떤 이유로 PR를 하셨나요?

  • feature 병합
  • 버그 수정(아래에 issue #를 남겨주세요)
  • 코드 개선
  • 코드 수정
  • 배포
  • 기타(아래에 자세한 내용 기입해주세요)

📋 세부 내용 - 왜 해당 PR이 필요한지 작업 내용을 자세하게 설명해주세요

JD 추출 시 raw text기반 검색에서 기업명에 검색이 끌려가는 현상을 방지하고자

  • jobTitle
  • task
  • requirements
  • preferredQualifications
    해당 필드로 검색을 수행해서 candidate 반환 후 confidence 높은 직무 추출

📸 작업 화면 스크린샷

⚠️ PR하기 전에 확인해주세요

  • 로컬테스트를 진행하셨나요?
  • 머지할 브랜치를 확인하셨나요?
  • 관련 label을 선택하셨나요?

🚨 관련 이슈 번호 [#27]

Summary by CodeRabbit

  • New Features

    • New user accounts now receive an initial credit upon signup.
  • Improvements

    • Job posting search has been optimized to utilize structured fields including job title, tasks, requirements, and preferred qualifications for more effective candidate matching and search performance.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

📝 Walkthrough

Walkthrough

This PR makes three focused changes: it refines job posting search queries to exclude unstructured raw text fields, adds comprehensive test coverage for that structured search behavior, and adjusts the default credit allocation for newly created users from 0 to 1.

Changes

Job Posting Search Query Refinement

Layer / File(s) Summary
Structured fields search query
src/main/java/com/jobdri/jobdri_api/domain/jobposting/service/JobPostingClassificationService.java
buildSearchQuery now omits extracted.rawText() from candidate matching, using only structured fields: jobTitle, task, requirements, and preferredQualifications.
Search query field validation test
src/test/java/com/jobdri/jobdri_api/domain/jobposting/service/JobPostingClassificationServiceTest.java
New JUnit 5 + Mockito test with argument capture verifies that findCandidates builds the trigram query using only structured fields and explicitly excludes rawText entries.

User Credit Initialization

Layer / File(s) Summary
Initial user credit value
src/main/java/com/jobdri/jobdri_api/domain/user/entity/User.java
User.signup(...) and User.createSocialUser(...) now initialize newly created users with credit(1) instead of credit(0).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops through code so clean,
Search queries purge the in-between,
Raw text departs, structures stay,
New users earn their credits today! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title '[Refactor] 채용공고 추출 검색 변경 (#27)' is partially related to the changeset. It mentions refactoring job posting extraction search, which aligns with changes to JobPostingClassificationService and related updates, but lacks English clarity and is somewhat brief in conveying the core issue being fixed (raw text search leading to company name drift).
Description check ✅ Passed The PR description follows the template structure, includes bug fix selection, provides detailed explanation of the changes (removing raw text from search, using only structured fields), references issue #27, and explains the problem and solution. However, local test, target branch, and labels checklist items are unchecked.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/#38-job-extract

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/com/jobdri/jobdri_api/domain/jobposting/service/JobPostingClassificationService.java (1)

20-24: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Guard against empty structured query before repository search.

When structured fields are all empty/null, buildSearchQuery(...) returns "", but Line 23 still executes trigram search. That can return noisy candidates and trigger unnecessary full-scope DB work.

Suggested fix
 public List<JobPostingClassificationCandidateResponse> findCandidates(JobPostingExtractResponse extracted, int limit) {
     String query = buildSearchQuery(extracted);
+    if (query.isBlank()) {
+        return List.of();
+    }
 
     return detailClassificationRepository.findTopCandidatesByTrigram(query, limit).stream()
             .map(this::toResponse)
             .toList();
 }

Also applies to: 28-35

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/main/java/com/jobdri/jobdri_api/domain/jobposting/service/JobPostingClassificationService.java`
around lines 20 - 24, The method findCandidates currently calls
buildSearchQuery(extracted) and unconditionally invokes
detailClassificationRepository.findTopCandidatesByTrigram(query, limit) even
when the structured query is empty, causing noisy/expensive DB work; update
findCandidates (and the similar flow around lines 28-35) to check if the
returned query is null or empty (e.g., trim().isEmpty()) and return an empty
List<JobPostingClassificationCandidateResponse> immediately instead of calling
detailClassificationRepository.findTopCandidatesByTrigram; keep using the
existing toResponse mapper for non-empty queries so behavior is unchanged for
valid queries.
🧹 Nitpick comments (1)
src/test/java/com/jobdri/jobdri_api/domain/jobposting/service/JobPostingClassificationServiceTest.java (1)

29-57: ⚡ Quick win

Add a blank-structured-fields test case.

Current coverage is good for “rawText exclusion,” but it doesn’t protect the edge case where structured fields are empty and only rawText has text. Add a test asserting no candidate search is performed (or empty result is returned) for that input.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/test/java/com/jobdri/jobdri_api/domain/jobposting/service/JobPostingClassificationServiceTest.java`
around lines 29 - 57, Add a new unit test alongside
findCandidatesUsesStructuredFieldsOnly that constructs a
JobPostingExtractResponse whose structured fields (title, subtitle, sections,
requirements, benefits, tags) are empty or blank while rawText contains
non-empty text, then call
jobPostingClassificationService.findCandidates(extracted, 5) and assert that
detailClassificationRepository.findTopCandidatesByTrigram is not invoked (or
returns an empty list) to verify no candidate search occurs for inputs with only
rawText; reference the existing test method name
findCandidatesUsesStructuredFieldsOnly, the JobPostingExtractResponse
constructor usage, jobPostingClassificationService.findCandidates(...) call, and
detailClassificationRepository.findTopCandidatesByTrigram(...) when implementing
this new test.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@src/main/java/com/jobdri/jobdri_api/domain/jobposting/service/JobPostingClassificationService.java`:
- Around line 20-24: The method findCandidates currently calls
buildSearchQuery(extracted) and unconditionally invokes
detailClassificationRepository.findTopCandidatesByTrigram(query, limit) even
when the structured query is empty, causing noisy/expensive DB work; update
findCandidates (and the similar flow around lines 28-35) to check if the
returned query is null or empty (e.g., trim().isEmpty()) and return an empty
List<JobPostingClassificationCandidateResponse> immediately instead of calling
detailClassificationRepository.findTopCandidatesByTrigram; keep using the
existing toResponse mapper for non-empty queries so behavior is unchanged for
valid queries.

---

Nitpick comments:
In
`@src/test/java/com/jobdri/jobdri_api/domain/jobposting/service/JobPostingClassificationServiceTest.java`:
- Around line 29-57: Add a new unit test alongside
findCandidatesUsesStructuredFieldsOnly that constructs a
JobPostingExtractResponse whose structured fields (title, subtitle, sections,
requirements, benefits, tags) are empty or blank while rawText contains
non-empty text, then call
jobPostingClassificationService.findCandidates(extracted, 5) and assert that
detailClassificationRepository.findTopCandidatesByTrigram is not invoked (or
returns an empty list) to verify no candidate search occurs for inputs with only
rawText; reference the existing test method name
findCandidatesUsesStructuredFieldsOnly, the JobPostingExtractResponse
constructor usage, jobPostingClassificationService.findCandidates(...) call, and
detailClassificationRepository.findTopCandidatesByTrigram(...) when implementing
this new test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0bd5a96f-2689-4851-b7f0-d2238a3c4f21

📥 Commits

Reviewing files that changed from the base of the PR and between 403db37 and 21b917c.

📒 Files selected for processing (3)
  • src/main/java/com/jobdri/jobdri_api/domain/jobposting/service/JobPostingClassificationService.java
  • src/main/java/com/jobdri/jobdri_api/domain/user/entity/User.java
  • src/test/java/com/jobdri/jobdri_api/domain/jobposting/service/JobPostingClassificationServiceTest.java

@shinae1023 shinae1023 merged commit c2b7e77 into main May 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant