Skip to content

Commit 5383b90

Browse files
sosyzLinkinStars
authored andcommitted
perf: optimize search for unanswered questions using answer_count
1 parent 80f139e commit 5383b90

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/repo/question/question_repo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ func (qr *questionRepo) GetQuestionPage(ctx context.Context, page, pageSize int,
385385
case "score":
386386
session.OrderBy("question.pin desc,question.vote_count DESC, question.view_count DESC")
387387
case "unanswered":
388-
session.Where("question.last_answer_id = 0")
388+
session.Where("question.answer_count = 0")
389389
session.OrderBy("question.pin desc,question.created_at DESC")
390390
}
391391

0 commit comments

Comments
 (0)