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.
refactor: rename UpdateSearch to updateSearch for consistency
hgaol278fdfd8c3bc
diff --git a/internal/repo/answer/answer_repo.go b/internal/repo/answer/answer_repo.goindex de91ed58..52963c44 100644--- a/internal/repo/answer/answer_repo.go+++ b/internal/repo/answer/answer_repo.go@@ -80,7 +80,7 @@ func (ar *answerRepo) AddAnswer(ctx context.Context, answer *entity.Answer) (erranswer.ID = uid.EnShortID(answer.ID)answer.QuestionID = uid.EnShortID(answer.QuestionID)}- _ = ar.UpdateSearch(ctx, answer.ID)+ _ = ar.updateSearch(ctx, answer.ID)return nil}@@ -93,7 +93,7 @@ func (ar *answerRepo) RemoveAnswer(ctx context.Context, answerID string) (err erif err != nil {return errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()}- _ = ar.UpdateSearch(ctx, answerID)+ _ = ar.updateSearch(ctx, answerID)return nil}@@ -106,7 +106,7 @@ func (ar *answerRepo) RecoverAnswer(ctx context.Context, answerID string) (err eif err != nil {return errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()}- _ = ar.UpdateSearch(ctx, answerID)+ _ = ar.updateSearch(ctx, answerID)return nil}@@ -139,7 +139,7 @@ func (ar *answerRepo) RemoveAllUserAnswer(ctx context.Context, userID string) (e// update search contentfor _, id := range answerIDs {- _ = ar.UpdateSearch(ctx, id)+ _ = ar.updateSearch(ctx, id)}return nil}@@ -152,7 +152,7 @@ func (ar *answerRepo) UpdateAnswer(ctx context.Context, answer *entity.Answer, cif err != nil {err = errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()}- _ = ar.UpdateSearch(ctx, answer.ID)+ _ = ar.updateSearch(ctx, answer.ID)return err}@@ -162,7 +162,7 @@ func (ar *answerRepo) UpdateAnswerStatus(ctx context.Context, answerID string, sif err != nil {return errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()}- _ = ar.UpdateSearch(ctx, answerID)+ _ = ar.updateSearch(ctx, answerID)return}@@ -251,7 +251,7 @@ func (ar *answerRepo) UpdateAcceptedStatus(ctx context.Context, acceptedAnswerIDreturn errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()}}- _ = ar.UpdateSearch(ctx, acceptedAnswerID)+ _ = ar.updateSearch(ctx, acceptedAnswerID)return nil}@@ -459,8 +459,8 @@ func (ar *answerRepo) SumVotesByQuestionID(ctx context.Context, questionID strinreturn count, nil}-// UpdateSearch update search, if search plugin not enable, do nothing-func (ar *answerRepo) UpdateSearch(ctx context.Context, answerID string) (err error) {+// updateSearch update search, if search plugin not enable, do nothing+func (ar *answerRepo) updateSearch(ctx context.Context, answerID string) (err error) {answerID = uid.DeShortID(answerID)// check search pluginvar (diff --git a/internal/service/answer_common/answer.go b/internal/service/answer_common/answer.goindex 1ab66458..989eb143 100644--- a/internal/service/answer_common/answer.go+++ b/internal/service/answer_common/answer.go@@ -48,7 +48,6 @@ type AnswerRepo interface {resp []*entity.Answer, total int64, err error)AdminSearchList(ctx context.Context, search *schema.AdminAnswerPageReq) ([]*entity.Answer, int64, error)UpdateAnswerStatus(ctx context.Context, answerID string, status int) (err error)- UpdateSearch(ctx context.Context, answerID string) (err error)GetAnswerCount(ctx context.Context) (count int64, err error)RemoveAllUserAnswer(ctx context.Context, userID string) (err error)SumVotesByQuestionID(ctx context.Context, questionID string) (float64, error)