Conversation
Summary of ChangesHello @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
🧠 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
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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.
| throw new IllegalStateException("Unknown post type: " + post.getClass()); | |
| throw new IllegalStateException("Unknown post type: " + post.getClass().getSimpleName()); |
| protected void onCreate() { | ||
| this.searchedAt = LocalDateTime.now(); | ||
| } |
There was a problem hiding this comment.
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.
| protected void onCreate() { | |
| this.searchedAt = LocalDateTime.now(); | |
| } | |
| @CreatedDate | |
| @Column(name = "searched_at", nullable = false, updatable = false) | |
| private LocalDateTime searchedAt; |
| LocalDateTime createdAt | ||
| ) { |
There was a problem hiding this comment.
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).
Summary
GET /search?keyword=xxx검색 API 추가 (작곡가 + 게시글)search_logs테이블에 키워드/시각/유저 자동 저장변경 파일
search/패키지 신규 생성 (domain, repository, application, presentation, dto)ComposerRepository: 이름 키워드 검색 메서드 추가PostRepository: 제목 키워드 검색 메서드 추가SecurityConfig:GET /search인증 없이 허용V8__create_search_logs.sql: search_logs 테이블 생성