From a907a97503a7039231fddccd2c31726e6e98bde6 Mon Sep 17 00:00:00 2001 From: hong seokho Date: Wed, 29 May 2024 17:56:47 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=EB=B3=80=EC=88=98=EB=AA=85=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member_friend/MemberFriendQueryRepositoryImpl.java | 8 ++++---- .../repository/MemberFriendQueryRepositoryTest.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/friend/repository/member_friend/MemberFriendQueryRepositoryImpl.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/friend/repository/member_friend/MemberFriendQueryRepositoryImpl.java index e58fdc147..7bc29fdd2 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/friend/repository/member_friend/MemberFriendQueryRepositoryImpl.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/friend/repository/member_friend/MemberFriendQueryRepositoryImpl.java @@ -173,12 +173,12 @@ public Optional findFriendsByTag( final QFriendInvite friendInviteToFriend = new QFriendInvite(FRIEND_INVITE_TO_FRIEND_PATH); final QFriendInvite friendInviteToMe = new QFriendInvite(FRIEND_INVITE_TO_ME_PATH); - NumberTemplate tagMatchTemplate = Expressions.numberTemplate(Double.class, + NumberTemplate tagFullTextSearchTemplate = Expressions.numberTemplate(Double.class, MATCH_AGAINST_FUNCTION, member.tag, tag); - OrderSpecifier tagEqCaseDesc = new CaseBuilder().when(member.tag.eq(tag)) + OrderSpecifier tagFullyMatchFirstOrder = new CaseBuilder().when(member.tag.eq(tag)) .then(Boolean.TRUE) .otherwise(Boolean.FALSE).desc(); @@ -203,8 +203,8 @@ public Optional findFriendsByTag( .leftJoin(friendInviteToMe) .on(friendInviteToMe.owner.id.eq(member.id) .and(friendInviteToMe.friend.id.eq(memberId))) - .where(tagMatchTemplate.gt(MATCH_THRESHOLD)) - .orderBy(tagEqCaseDesc, tagMatchTemplate.desc()) + .where(tagFullTextSearchTemplate.gt(MATCH_THRESHOLD)) + .orderBy(tagFullyMatchFirstOrder, tagFullTextSearchTemplate.desc()) .limit(1L) .fetchOne() ); diff --git a/backend/core/src/test/java/site/timecapsulearchive/core/domain/friend/repository/MemberFriendQueryRepositoryTest.java b/backend/core/src/test/java/site/timecapsulearchive/core/domain/friend/repository/MemberFriendQueryRepositoryTest.java index 92df26177..09ae4cf3d 100644 --- a/backend/core/src/test/java/site/timecapsulearchive/core/domain/friend/repository/MemberFriendQueryRepositoryTest.java +++ b/backend/core/src/test/java/site/timecapsulearchive/core/domain/friend/repository/MemberFriendQueryRepositoryTest.java @@ -40,7 +40,7 @@ @TestConstructor(autowireMode = AutowireMode.ALL) class MemberFriendQueryRepositoryTest extends RepositoryTest { - private static String PROPAGATION_REQUIRES_NEW = "PROPAGATION_REQUIRES_NEW"; + private static final String PROPAGATION_REQUIRES_NEW = "PROPAGATION_REQUIRES_NEW"; private static final int MAX_COUNT = 10; private static final Long FRIEND_START_ID = 2L; private static final Long FRIEND_ID_TO_INVITE_OWNER = 12L;