Skip to content

Comments

[feat] 키워드 검색 및 search_logs 저장 기능 추가#88

Merged
k3vin7 merged 1 commit intomainfrom
feat/searchLogs
Feb 22, 2026
Merged

[feat] 키워드 검색 및 search_logs 저장 기능 추가#88
k3vin7 merged 1 commit intomainfrom
feat/searchLogs

Conversation

@k3vin7
Copy link
Contributor

@k3vin7 k3vin7 commented Feb 22, 2026

Summary

  • GET /search?keyword=xxx 검색 API 추가 (작곡가 + 게시글)
  • 검색 시 search_logs 테이블에 키워드/시각/유저 자동 저장
  • 비로그인 유저도 검색 가능 (user_id는 null로 저장)

변경 파일

  • search/ 패키지 신규 생성 (domain, repository, application, presentation, dto)
  • ComposerRepository: 이름 키워드 검색 메서드 추가
  • PostRepository: 제목 키워드 검색 메서드 추가
  • SecurityConfig: GET /search 인증 없이 허용
  • V8__create_search_logs.sql: search_logs 테이블 생성

@gemini-code-assist
Copy link

Summary of Changes

Hello @k3vin7, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 사용자가 키워드를 통해 작곡가와 게시글을 통합적으로 검색할 수 있는 기능을 도입합니다. 검색 요청은 자동으로 기록되어 추후 분석에 활용될 수 있으며, 로그인 여부와 관계없이 모든 사용자가 검색 기능을 이용할 수 있도록 접근성을 확장했습니다.

Highlights

  • 키워드 검색 API 추가: 새로운 /search API가 추가되어 키워드로 작곡가와 게시글을 통합적으로 검색할 수 있습니다.
  • 검색 기록 저장 기능: 검색 시 키워드, 검색 시각, 사용자 ID가 search_logs 테이블에 자동으로 저장됩니다.
  • 비로그인 사용자 검색 허용: 비로그인 사용자도 검색 기능을 이용할 수 있으며, 이 경우 user_id는 null로 저장됩니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/main/java/com/daramg/server/auth/config/SecurityConfig.java
    • GET /search 엔드포인트에 대한 인증 없이 접근을 허용하도록 보안 설정을 업데이트했습니다.
  • src/main/java/com/daramg/server/composer/repository/ComposerRepository.java
    • 작곡가의 한국어 이름 또는 영어 이름으로 검색할 수 있는 쿼리 메서드를 추가했습니다.
  • src/main/java/com/daramg/server/post/repository/PostRepository.java
    • 게시글 제목, 상태, 차단 여부를 기준으로 게시글을 검색할 수 있는 쿼리 메서드를 추가했습니다.
  • src/main/java/com/daramg/server/search/application/SearchService.java
    • 검색 로직을 처리하고 검색 기록을 저장하며, 작곡가와 게시글 검색 결과를 통합하는 SearchService를 새로 추가했습니다.
  • src/main/java/com/daramg/server/search/domain/SearchLog.java
    • 검색 기록을 저장하기 위한 SearchLog 엔티티를 새로 정의했습니다.
  • src/main/java/com/daramg/server/search/dto/SearchResponseDto.java
    • 검색 결과를 담는 SearchResponseDto와 내부 레코드(ComposerResult, PostResult)를 새로 정의했습니다.
  • src/main/java/com/daramg/server/search/presentation/SearchController.java
    • /search 엔드포인트를 처리하는 SearchController를 새로 추가했습니다.
  • src/main/java/com/daramg/server/search/repository/SearchLogRepository.java
    • SearchLog 엔티티를 위한 SearchLogRepository 인터페이스를 새로 추가했습니다.
  • src/main/resources/db/migration/V8__create_search_logs.sql
    • search_logs 테이블을 생성하는 Flyway 마이그레이션 스크립트를 추가했습니다.
  • src/test/java/com/daramg/server/search/presentation/SearchControllerTest.java
    • SearchController의 검색 기능을 검증하는 통합 테스트를 추가했습니다.
Activity
  • 현재까지 풀 리퀘스트에 대한 추가적인 활동은 없습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces a new search functionality, allowing users to search for composers and posts by keyword. It also includes logging of search queries, even for unauthenticated users. The changes are well-structured, separating concerns into domain, repository, application, presentation, and dto packages. The addition of a dedicated SearchService and SearchController is good for modularity. The database migration for search_logs is also correctly implemented. Overall, the changes are functional and address the requirements outlined in the summary.

if (post instanceof StoryPost) return PostType.STORY;
if (post instanceof FreePost) return PostType.FREE;
if (post instanceof CurationPost) return PostType.CURATION;
throw new IllegalStateException("Unknown post type: " + post.getClass());

Choose a reason for hiding this comment

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

medium

The resolvePostType method uses instanceof checks, which can become cumbersome and less maintainable as more Post subtypes are introduced. Consider adding an abstract getPostType() method to the Post class (or an interface) that each subclass implements to return its specific type. This would make the resolvePostType method simpler and more extensible.

Suggested change
throw new IllegalStateException("Unknown post type: " + post.getClass());
throw new IllegalStateException("Unknown post type: " + post.getClass().getSimpleName());

Comment on lines +35 to +37
protected void onCreate() {
this.searchedAt = LocalDateTime.now();
}

Choose a reason for hiding this comment

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

medium

The onCreate method sets searchedAt using LocalDateTime.now(). While this works, it's generally better practice to use Spring Data JPA's @CreatedDate annotation from AuditingEntityListener for automatic timestamping. This centralizes auditing concerns and reduces boilerplate code.

Suggested change
protected void onCreate() {
this.searchedAt = LocalDateTime.now();
}
@CreatedDate
@Column(name = "searched_at", nullable = false, updatable = false)
private LocalDateTime searchedAt;

Comment on lines +33 to +34
LocalDateTime createdAt
) {

Choose a reason for hiding this comment

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

medium

The writerNickname field in PostResult directly exposes the user's nickname. While this might be acceptable for public search results, ensure that there are no privacy concerns with exposing this information. If the user can delete their account or change their nickname, this might lead to inconsistencies or broken references in historical search results if not handled carefully (e.g., by making writerNickname nullable or using a default value if the user no longer exists).

@k3vin7 k3vin7 merged commit a505332 into main Feb 22, 2026
1 check passed
@k3vin7 k3vin7 deleted the feat/searchLogs branch February 22, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant