-
Notifications
You must be signed in to change notification settings - Fork 2
refactor: api/search 쿼리문 수정 #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "197-refactor-\uD0D0\uC0C9-\uD654\uBA74-\uC18C\uD504\uD2B8-\uB51C\uB9AC\uD2B8-\uCE74\uB4DC-\uC81C\uC678"
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @kjhh2605, 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!
This pull request refactors the API search query by modifying the findByCursor method within the CardRepository. The primary purpose of this change is to enhance the accuracy and relevance of search results by applying stricter filtering. It ensures that the search functionality only returns Card entities that are not marked as deleted and are explicitly designated as shared, thereby improving data consistency for users.
Highlights
- API Query Refinement: The
findByCursormethod inCardRepositoryhas been updated to include additional filtering criteria. - Data Filtering: The query now explicitly excludes cards marked as
isDeleted = trueand includes only cards whereisShared = true.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| 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 issue 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
-
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. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
이번 PR은 전체 카드 조회 쿼리에 삭제 여부(isDeleted)와 공유 여부(isShared) 조건을 추가하여, 의도에 맞게 공유되고 삭제되지 않은 카드만 조회하도록 수정한 것으로 보입니다. 이는 데이터 정확성 측면에서 올바른 수정입니다.
리뷰에서는 두 가지 개선점을 제안했습니다. 첫째, 데이터가 증가함에 따라 발생할 수 있는 성능 저하를 방지하기 위해 (is_deleted, is_shared, id)에 대한 데이터베이스 복합 인덱스 추가를 권장했습니다. 둘째, 쿼리의 내용이 변경된 만큼, findByCursor라는 일반적인 메서드 이름을 findSharedCardsByCursor와 같이 더 명확한 이름으로 변경하여 코드의 가독성을 높이는 것을 제안했습니다.
| @Query(""" | ||
| SELECT c FROM Card c | ||
| WHERE (:cursor IS NULL OR c.id > :cursor) | ||
| AND c.isDeleted = false | ||
| AND c.isShared = true | ||
| ORDER BY c.id ASC | ||
| """) | ||
| Slice<Card> findByCursor(@Param("cursor") Long cursor, Pageable pageable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
쿼리에 isDeleted = false와 isShared = true 조건을 추가하여 삭제되거나 공유되지 않은 카드만 필터링하도록 수정한 것은 데이터 정확성 측면에서 좋은 개선입니다.
다만, 몇 가지 개선점을 제안합니다:
- 성능 최적화:
cards테이블의 데이터가 많아질 경우 성능 저하가 발생할 수 있습니다.(is_deleted, is_shared, id)컬럼에 대한 복합 인덱스를 추가하면WHERE절과ORDER BY절의 성능을 크게 향상시킬 수 있습니다.Card엔티티의@Table어노테이션에 인덱스를 정의하는 것을 고려해 보세요. - 메서드 이름 명확화: 쿼리의 역할이 더 명확해졌으므로, 메서드 이름도 이를 반영하도록 변경하는 것이 좋습니다. 예를 들어,
findByCursor대신findSharedCardsByCursor와 같이 변경하면 코드의 가독성과 유지보수성이 향상될 것입니다.
#️⃣연관된 이슈
📝작업 내용
스크린샷 (선택)
💬리뷰 요구사항(선택)