Skip to content

Commit

Permalink
perf: use metaTags in subject table
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Nov 25, 2024
1 parent 792c56b commit b0d5e5a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions internal/search/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,24 @@ func (c *client) Handle(ctx echo.Context) error {
return errgo.Wrap(err, "subjectRepo.GetByIDs")
}

tags, err := c.tagRepo.GetByIDs(ctx.Request().Context(), ids)
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]
// metaTags := tags[id]
var metaTags []tag.Tag

for _, t := range strings.Split(s.MetaTags, " ") {
metaTags = append(metaTags, tag.Tag{Name: t, Count: 1})
}

subject := toResponseSubject(s, metaTags)
data = append(data, subject)
}
Expand Down

0 comments on commit b0d5e5a

Please sign in to comment.