From 42c1534918442506b6a165ba52afc6713b441f08 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Tue, 26 Nov 2024 00:43:12 +0800 Subject: [PATCH] Revert "perf: only get meta tags for non-empty string" This reverts commit 867e0f06083a2b8b014c842accffb778676d1997. --- 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 ed580a22..f0d94322 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})