From b5a9fe0c386f733b6a8f49cb17aefb66187847c5 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Tue, 26 Nov 2024 01:24:32 +0800 Subject: [PATCH] Revert "perf: only get meta tags for non-empty string" This reverts commit 679000afb3b1a011b517a16ca2a53599e45fe0af. --- internal/search/handle.go | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/internal/search/handle.go b/internal/search/handle.go index 42e88396..44061308 100644 --- a/internal/search/handle.go +++ b/internal/search/handle.go @@ -135,17 +135,10 @@ func (c *client) Handle(ctx echo.Context) error { return errgo.Wrap(err, "subjectRepo.GetByIDs") } - var idsToGetTags []model.SubjectID - for _, m := range subjects { - if m.MetaTags != "" { - idsToGetTags = append(idsToGetTags, m.ID) - } - } - - tags, err := c.tagRepo.GetByIDs(ctx.Request().Context(), idsToGetTags) - if err != nil { - return errgo.Wrap(err, "tagRepo.GetByIDs") - } + // tags, err := c.tagRepo.GetByIDs(ctx.Request().Context(), ids) + // if err != nil { + // return errgo.Wrap(err, "tagRepo.GetByIDs") + // } var data = make([]ReponseSubject, 0, len(subjects)) for _, id := range ids { @@ -153,10 +146,8 @@ func (c *client) Handle(ctx echo.Context) error { if !ok { continue } - metaTags := tags[id] - if metaTags == nil { - metaTags = []tag.Tag{} - } + // metaTags := tags[id] + var metaTags []tag.Tag for _, t := range strings.Split(s.MetaTags, " ") { metaTags = append(metaTags, tag.Tag{Name: t, Count: 1})