Skip to content

Commit

Permalink
Fix: give 0.0 to score when keyword is null or empty on notice. (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
huGgW authored Apr 7, 2024
1 parent 5a9a8b4 commit 641b2e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.wafflestudio.csereal.core.notice.database

import com.querydsl.core.BooleanBuilder
import com.querydsl.core.types.Projections
import com.querydsl.core.types.dsl.Expressions
import com.querydsl.jpa.impl.JPAQueryFactory
import com.wafflestudio.csereal.common.enums.ContentSearchSortType
import com.wafflestudio.csereal.common.repository.CommonRepository
Expand Down Expand Up @@ -142,7 +143,8 @@ class NoticeRepositoryImpl(
noticeEntity.isPinned,
noticeEntity.attachments.isNotEmpty,
noticeEntity.isPrivate,
scoreOrNull
// if scoreOrNull is null, put 0.0
scoreOrNull ?: Expressions.numberTemplate(Double::class.javaObjectType, "0.0")
)
).from(noticeEntity)
.leftJoin(noticeTagEntity).on(noticeTagEntity.notice.eq(noticeEntity))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ data class NoticeSearchDto(
isPinned: Boolean,
hasAttachment: Boolean,
isPrivate: Boolean,
score: Double?
score: Double
) : this(id, title, createdAt, isPinned, hasAttachment, isPrivate)

constructor(entity: NoticeEntity, hasAttachment: Boolean) : this(
Expand Down

0 comments on commit 641b2e0

Please sign in to comment.