Skip to content

Commit

Permalink
Revert "perf: only get meta tags for non-empty string"
Browse files Browse the repository at this point in the history
This reverts commit 679000a.
  • Loading branch information
trim21 committed Nov 25, 2024
1 parent b136b60 commit b5a9fe0
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions internal/search/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,28 +135,19 @@ 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 {
s, ok := subjects[id]
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})
Expand Down

0 comments on commit b5a9fe0

Please sign in to comment.