Skip to content

Commit

Permalink
serch by regex
Browse files Browse the repository at this point in the history
  • Loading branch information
AnjeZenda committed Dec 5, 2024
1 parent 4534b37 commit 9779b1e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions server/internal/storage/plants.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,12 @@ func parseLabelsToBSON(labels map[string]interface{}) bson.D {
for k, v := range labels {
switch vc := v.(type) {
case string:
if k == "species" {
bsonFltr = append(bsonFltr, bson.E{Key: k, Value: bson.M{"$regex": vc, "$options": "i"}})
} else {
bsonFltr = append(bsonFltr, bson.E{Key: k, Value: vc})
}
// if k == "species" {
// bsonFltr = append(bsonFltr, bson.E{Key: k, Value: bson.M{"$regex": vc, "$options": "i"}})
// } else {
// bsonFltr = append(bsonFltr, bson.E{Key: k, Value: vc})
// }
bsonFltr = append(bsonFltr, bson.E{Key: k, Value: bson.M{"$regex": vc, "$options": "i"}})
case []string:
bsonFltr = createOrFilter(k, vc)
}
Expand Down

0 comments on commit 9779b1e

Please sign in to comment.