Skip to content

Commit 4e281f6

Browse files
authored
Merge pull request #365 from GarakChoi/develop
Feat[totalsearch] : 법령 + 판례 총 건수 추가
2 parents 8730c6d + 4dacb0d commit 4e281f6

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

backend/sql/precedent_fulltext.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
ALTER TABLE precedent
2-
ADD FULLTEXT idx_precedent_fulltext (notice, summary_of_the_judgment, precedent_content, case_name, case_number);
2+
ADD FULLTEXT idx_precedent_fulltext (notice, summary_of_the_judgment, precedent_content, case_name, case_number);

backend/src/main/java/com/ai/lawyer/domain/law/repository/LawRepositoryCustomImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ public Page<LawsDto> searchLaws(LawSearchRequestDto searchRequest) {
103103

104104
List<LawsDto> content = query.fetch();
105105

106-
if (content.isEmpty()) {
107-
return new PageImpl<>(content, pageable, 0);
108-
}
106+
// if (content.isEmpty()) {
107+
// return new PageImpl<>(content, pageable, 0);
108+
// }
109109

110110
// 조회한 법령 ID 목록 추출
111111
List<Long> lawIds = content.stream()

backend/src/main/java/com/ai/lawyer/domain/totalSearch/dto/SearchResponseDto.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ public class SearchResponseDto {
1818

1919
@Schema(description = "판례 검색 결과 페이지")
2020
private PageResponseDto precedents;
21-
}
2221

22+
@Schema(description = "법령 + 판례 통합 총 건수")
23+
private long lawPrecTotalElements;
24+
}

backend/src/main/java/com/ai/lawyer/domain/totalSearch/service/SearchServiceImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ public SearchResponseDto combinedSearch(SearchRequestDto request) {
7272
response.setPrecedents(precResult == null ? null : (PageResponseDto) precResult);
7373
}
7474

75+
// 통합 total 계산: laws.totalElements + precedents.totalElements
76+
long lawsTotal = response.getLaws() != null ? response.getLaws().getTotalElements() : 0L;
77+
long precTotal = response.getPrecedents() != null ? response.getPrecedents().getTotalElements() : 0L;
78+
response.setLawPrecTotalElements(lawsTotal + precTotal);
79+
7580
if (request.isIncludeLaws() && request.isIncludePrecedents()
7681
&& response.getLaws() == null && response.getPrecedents() == null) {
7782
throw new RuntimeException("법령 및 판례 검색 모두 실패");
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)