From 58c5b2b9abd0ae4a0f9769ea1e50708fd4d74287 Mon Sep 17 00:00:00 2001 From: redblackblossom Date: Thu, 15 Aug 2024 16:51:24 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20photos=5Fes=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EC=A1=B0=ED=9A=8C=EC=9D=98=20=EA=B2=B0=EA=B3=BC?= =?UTF-8?q?=EA=B0=80=20=EB=AC=B4=EC=A1=B0=EA=B1=B4=20isLast=EA=B0=92?= =?UTF-8?q?=EC=9D=B4=20true=EC=9D=B8=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/PhotoEsClientRepository.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/photo/elasticsearch/repository/PhotoEsClientRepository.java b/src/main/java/com/umc/naoman/domain/photo/elasticsearch/repository/PhotoEsClientRepository.java index fd6f43d..8efcada 100644 --- a/src/main/java/com/umc/naoman/domain/photo/elasticsearch/repository/PhotoEsClientRepository.java +++ b/src/main/java/com/umc/naoman/domain/photo/elasticsearch/repository/PhotoEsClientRepository.java @@ -89,7 +89,7 @@ public Page findPhotoEsByShareGroupId(Long shareGroupId, Pageable pagea } catch (IOException e) { throw new BusinessException(ElasticsearchErrorCode.ELASTICSEARCH_IOEXCEPTION, e); } - return toPagePhotoEs(response.hits().hits(), pageable); + return toPagePhotoEs(response.hits().hits(), pageable, response.hits().total().value()); } //특정 공유 그룹의 얼굴이 태그된 사진 검색 @@ -127,7 +127,7 @@ public Page findPhotoEsByShareGroupIdAndFaceTag(Long shareGroupId, Long throw new BusinessException(ElasticsearchErrorCode.ELASTICSEARCH_IOEXCEPTION, e); } - return toPagePhotoEs(response.hits().hits(), pageable); + return toPagePhotoEs(response.hits().hits(), pageable,response.hits().total().value()); } //특정 공유 그룹의 얼굴이 태그되지 않은 사진 검색 @@ -164,7 +164,7 @@ public Page findPhotoEsByShareGroupIdAndNotFaceTag(Long shareGroupId, P throw new BusinessException(ElasticsearchErrorCode.ELASTICSEARCH_IOEXCEPTION, e); } - return toPagePhotoEs(response.hits().hits(), pageable); + return toPagePhotoEs(response.hits().hits(), pageable,response.hits().total().value()); } // rdsId로 ES에서 사진 삭제 @@ -304,9 +304,11 @@ String esTimeFormat(LocalDateTime localDateTime) { return localDateTime.format(dateTimeFormatter); } - private Page toPagePhotoEs(List> hits, Pageable pageable) { - List photoEsList = hits.stream().map(Hit::source).collect(Collectors.toList()); - return new PageImpl<>(photoEsList, pageable, hits.size()); + private Page toPagePhotoEs(List> hits, Pageable pageable, long total) { + List photoEsList = hits.stream() + .map(Hit::source) + .collect(Collectors.toList()); + return new PageImpl<>(photoEsList, pageable, total); } private int getFrom(Pageable pageable) {