Merge pull request #6512 from aduffeck/fix-case-insensitivity

Always make Name and Tags queries case-insensitive
This commit is contained in:
Andre Duffeck
2023-06-20 08:39:50 +02:00
committed by GitHub

View File

@@ -368,6 +368,7 @@ func formatQuery(q string) string {
fieldRe := regexp.MustCompile(`\w+:[^ ]+`)
if fieldRe.MatchString(cq) {
nameTagesRe := regexp.MustCompile(`\+?(Name|Tags)`) // detect "Name", "+Name, "Tags" and "+Tags"
parts := strings.Split(cq, " ")
cq = ""
@@ -376,7 +377,7 @@ func formatQuery(q string) string {
if len(fieldParts) > 1 {
key := fieldParts[0]
value := fieldParts[1]
if key == "Name" || key == "Tags" {
if nameTagesRe.MatchString(key) {
value = strings.ToLower(value) // do a lowercase query on the lowercased fields
}
cq += key + ":" + value + " "