diff --git a/internal/search/client.go b/internal/search/client.go index b3b3b50a..d92627b9 100644 --- a/internal/search/client.go +++ b/internal/search/client.go @@ -39,7 +39,6 @@ import ( "github.com/bangumi/server/domain/gerr" "github.com/bangumi/server/internal/model" "github.com/bangumi/server/internal/subject" - "github.com/bangumi/server/internal/tag" ) // New provide a search app is AppConfig.MeiliSearchURL is empty string, return nope search client. @@ -48,7 +47,6 @@ import ( func New( cfg config.AppConfig, subjectRepo subject.Repo, - tagRepo tag.CachedRepo, log *zap.Logger, query *query.Query, ) (Client, error) { @@ -80,7 +78,6 @@ func New( subjectIndex: meili.Index("subjects"), log: log.Named("search"), subjectRepo: subjectRepo, - tagRepo: tagRepo, } if cfg.AppType != config.AppTypeCanal { @@ -139,7 +136,6 @@ func (c *client) canalInit(cfg config.AppConfig) error { type client struct { subjectRepo subject.Repo - tagRepo tag.CachedRepo meili meilisearch.ServiceManager q *query.Query subjectIndex meilisearch.IndexManager diff --git a/internal/search/handle.go b/internal/search/handle.go index 44061308..dc7978c2 100644 --- a/internal/search/handle.go +++ b/internal/search/handle.go @@ -135,21 +135,18 @@ 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") - // } - var data = make([]ReponseSubject, 0, len(subjects)) for _, id := range ids { s, ok := subjects[id] if !ok { continue } - // metaTags := tags[id] var metaTags []tag.Tag for _, t := range strings.Split(s.MetaTags, " ") { + if t == "" { + continue + } metaTags = append(metaTags, tag.Tag{Name: t, Count: 1}) }