Skip to content

Commit

Permalink
[hotfix] 키워드 포함 인기 레코드 조회 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
jinkonu committed Jul 16, 2024
1 parent 6be3cb2 commit 040b519
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,11 @@ public Slice<RecordEntity> findAllByKeywordsOrderByPopularity(List<KeywordEntity

List<RecordEntity> recordEntities = jpaQueryFactory
.selectFrom(recordEntity)
.leftJoin(recordEntity.bookmarks, bookmarkEntity)
.leftJoin(recordEntity.views, viewEntity)
.leftJoin(recordEntity.bookmarks, bookmarkEntity).on(bookmarkEntity.createdAt.after(sevenDaysAgo))
.leftJoin(recordEntity.views, viewEntity).on(viewEntity.createdAt.after(sevenDaysAgo))
.join(recordEntity.uploads, uploadEntity)
.join(uploadEntity.keyword, keywordEntity)
.where(
bookmarkEntity.createdAt.after(sevenDaysAgo)
.or(viewEntity.createdAt.after(sevenDaysAgo)),
keywordEntity.in(keywords)
)
.where(keywordEntity.in(keywords))
.groupBy(recordEntity.id)
.orderBy(bookmarkEntity.count().multiply(2).add(viewEntity.count()).desc())
.offset(pageable.getOffset())
Expand Down

0 comments on commit 040b519

Please sign in to comment.