Skip to content

Commit

Permalink
fix: one tag match only
Browse files Browse the repository at this point in the history
  • Loading branch information
Rorical committed Nov 30, 2023
1 parent c3635a3 commit e977700
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions common/database/operations/illust.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,17 @@ func (ops *DatabaseOperations) SearchIllust(ctx context.Context, keyword string,
func (ops *DatabaseOperations) QueryIllustsByTags(ctx context.Context, tags []string, page int64, limit int64, sortpopularity bool, sortdate bool, resultbanned bool) ([]models.Illust, error) {
var results []models.Illust

var filter interface{}

if len(tags) > 1 {
filter = bson.M{"$in": tags}
} else {
filter = tags[0]
}

query := bson.M{
"tags.name": bson.M{
"$in": tags,
},
"banned": false,
"tags.name": filter,
"banned": false,
}
if resultbanned {
query["banned"] = true
Expand Down

0 comments on commit e977700

Please sign in to comment.