A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
perf: optimize search for unanswered questions using answer_count
Sonui5afa01ba8982
diff --git a/internal/repo/question/question_repo.go b/internal/repo/question/question_repo.goindex 5a683af7..83a84157 100644--- a/internal/repo/question/question_repo.go+++ b/internal/repo/question/question_repo.go@@ -385,7 +385,7 @@ func (qr *questionRepo) GetQuestionPage(ctx context.Context, page, pageSize int,case "score":session.OrderBy("question.pin desc,question.vote_count DESC, question.view_count DESC")case "unanswered":- session.Where("question.last_answer_id = 0")+ session.Where("question.answer_count = 0")session.OrderBy("question.pin desc,question.created_at DESC")}