Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ public StudyPreviewDTO findLikedStudies(Long memberId, Pageable pageable) {
public StudyPreviewDTO findStudiesByKeyword(Pageable pageable,
String keyword, StudySortBy sortBy) {
// 키워드로 스터디 조회
List<Study> studies = studyRepository.searchByTitle(keyword, sortBy, pageable);
List<Study> studies = studyRepository.findAllByTitleContaining(keyword, sortBy, pageable);
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

LGTM: Consistent implementation of like-based search.

The change to findAllByTitleContaining properly implements the like-based query method as mentioned in the PR objectives. The Spring Data JPA naming convention correctly translates to a SQL LIKE '%keyword%' operation for more flexible title searching.

Let's verify that the old searchByTitle method is no longer referenced elsewhere in the codebase:


🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining references to the old searchByTitle method
# Expected: No occurrences of searchByTitle method calls

echo "Searching for any remaining references to searchByTitle method..."
rg "searchByTitle" --type java

Length of output: 516


🏁 Script executed:

#!/bin/bash
# Description: Check for any invocation sites of the old searchByTitle method
echo "Searching for any call sites to searchByTitle..."
rg "\.searchByTitle" -n --type java

Length of output: 144


Remove unused searchByTitle declarations

Our search confirms there are no remaining calls to searchByTitle, but its signatures still exist in the custom repository interface and implementation. These should be cleaned up to avoid dead code:

• src/main/java/com/example/spot/repository/querydsl/StudyRepositoryCustom.java
• src/main/java/com/example/spot/repository/querydsl/impl/StudyRepositoryCustomImpl.java

Please remove the searchByTitle(...) method from both files.

🤖 Prompt for AI Agents
In src/main/java/com/example/spot/repository/querydsl/StudyRepositoryCustom.java
and
src/main/java/com/example/spot/repository/querydsl/impl/StudyRepositoryCustomImpl.java,
remove the unused searchByTitle method declarations and implementations
respectively, as they are no longer called anywhere in the codebase. This
cleanup will eliminate dead code and improve maintainability.

💡 Verification agent

🧩 Analysis chain

LGTM! Improved method naming follows Spring Data JPA conventions.

The change from searchByTitle to findAllByTitleContaining provides better clarity about the method's functionality and follows Spring Data JPA query method naming conventions.

Verify that all references to the old searchByTitle method have been updated throughout the codebase:


🏁 Script executed:

#!/bin/bash
# Description: Search for any remaining references to the old searchByTitle method
# Expected: No occurrences should be found

echo "Searching for old method name 'searchByTitle'..."
rg "searchByTitle" --type java

echo "Searching for new method name 'findAllByTitleContaining'..."
rg "findAllByTitleContaining" --type java

Length of output: 1803


Remove remaining searchByTitle methods in the custom repository

The search revealed that the old searchByTitle API still exists alongside the new findAllByTitleContaining in your QueryDSL-based repository. To complete the rename and avoid confusion, please remove or rename these leftover definitions:

• src/main/java/com/example/spot/repository/querydsl/StudyRepositoryCustom.java

-    List<Study> searchByTitle(String keyword, StudySortBy sortBy, Pageable pageable);
+    // removed in favor of findAllByTitleContaining(...)

• src/main/java/com/example/spot/repository/querydsl/impl/StudyRepositoryCustomImpl.java

-    public List<Study> searchByTitle(String keyword, StudySortBy sortBy, Pageable pageable) {
-        …implementation…
-    }
+    // implementation consolidated under findAllByTitleContaining(...)

After removing these, ensure any callers (if any) are updated to use findAllByTitleContaining.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/main/java/com/example/spot/service/study/StudyQueryServiceImpl.java at
line 678, you are already using the new method findAllByTitleContaining. To
complete the transition, remove the old searchByTitle method definitions from
src/main/java/com/example/spot/repository/querydsl/StudyRepositoryCustom.java
and
src/main/java/com/example/spot/repository/querydsl/impl/StudyRepositoryCustomImpl.java.
Also, verify that no other code calls searchByTitle; if found, update those
calls to use findAllByTitleContaining instead.


// 조회된 스터디가 없을 경우
if (studies.isEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ void findStudiesByKeyword() {
String keyword = "English";
StudySortBy sortBy = StudySortBy.ALL;

when(studyRepository.searchByTitle(keyword, sortBy, pageable))
when(studyRepository.findAllByTitleContaining(keyword, sortBy, pageable))
.thenReturn(List.of(study1));
when(studyRepository.countAllByTitleContaining(keyword, sortBy))
.thenReturn(1L);
Expand All @@ -1589,7 +1589,7 @@ void findStudiesByKeyword() {
// then
assertNotNull(result);
assertEquals(1, result.getTotalElements());
verify(studyRepository).searchByTitle(keyword, sortBy, pageable);
verify(studyRepository).findAllByTitleContaining(keyword, sortBy, pageable);
}

@Test
Expand All @@ -1599,7 +1599,7 @@ void findStudiesByKeyword() {
String keyword = "English";
StudySortBy sortBy = StudySortBy.ALL;

when(studyRepository.searchByTitle(keyword, sortBy, pageable))
when(studyRepository.findAllByTitleContaining(keyword, sortBy, pageable))
.thenReturn(List.of());

// when & then
Expand Down