{"record":{"id":"00cb2b915cede600","repo":"Tencent/WeKnora","slug":"unsupported-operator-v","errorCode":null,"errorMessage":"unsupported operator: %v","messagePattern":"unsupported operator: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/repository/retriever/milvus/filter.go","lineNumber":156,"sourceCode":"\tcond *universalFilterCondition,\n\tcounter *int,\n) (*convertResult, error) {\n\tif cond == nil {\n\t\treturn nil, fmt.Errorf(\"milvus filter condition is nil\")\n\t}\n\tswitch cond.Operator {\n\tcase operatorEqual, operatorNotEqual, operatorGreaterThan,\n\t\toperatorGreaterThanOrEqual, operatorLessThan,\n\t\toperatorLessThanOrEqual, operatorLike, operatorNotLike:\n\t\treturn c.convertComparisonCondition(cond, counter)\n\tcase operatorAnd, operatorOr:\n\t\treturn c.convertLogicalCondition(cond, counter)\n\tcase operatorIn, operatorNotIn:\n\t\treturn c.convertInCondition(cond, counter)\n\tcase operatorBetween:\n\t\treturn c.convertBetweenCondition(cond, counter)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported operator: %v\", cond.Operator)\n\t}\n}\n\nfunc (c *filter) convertInCondition(\n\tcond *universalFilterCondition,\n\tcounter *int,\n) (*convertResult, error) {\n\tcondField := cond.Field\n\tif condField == \"\" || cond.Value == nil {\n\t\treturn nil, fmt.Errorf(\"milvus filter condition is nil\")\n\t}\n\n\ts := reflect.ValueOf(cond.Value)\n\tif s.Kind() != reflect.Slice || s.Len() <= 0 {\n\t\treturn nil, fmt.Errorf(\"in operator value must be a slice with at least one value: %v\", cond.Value)\n\t}\n\n\tparamName := c.convertParamName(cond.Field, counter)","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/repository/retriever/milvus/filter.go#L138-L174","documentation":"convertCondition switches on cond.Operator and returns this error in the default branch when the operator is not one of the supported comparison, logical, IN, NOT IN, or BETWEEN operators. The unrecognized operator is interpolated into the message.","triggerScenarios":"Setting Operator on a condition to a typo, an operator from another retriever backend, an empty string, or a Milvus-only operator not mapped in this package.","commonSituations":"Migrating filters between vector-store backends with different operator vocabularies; hand-writing JSON filters with lowercase or invented operator names; renames across library versions.","solutions":["Use only operators defined by this package (EQUAL, NOT_EQUAL, GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL, LIKE, NOT_LIKE, AND, OR, IN, NOT_IN, BETWEEN)","Check the exact operator string for typos or casing differences","Map foreign operators to supported ones before calling Convert"],"exampleFix":"// before\ncond := &UniversalFilterCondition{Field: \"status\", Operator: \"eq\", Value: \"active\"}\n// after\ncond := &UniversalFilterCondition{Field: \"status\", Operator: \"EQUAL\", Value: \"active\"}","handlingStrategy":"validation","validationCode":"var supported = map[string]bool{\n  \"EQUAL\": true, \"NOT_EQUAL\": true, \"GREATER_THAN\": true, \"GREATER_THAN_OR_EQUAL\": true,\n  \"LESS_THAN\": true, \"LESS_THAN_OR_EQUAL\": true, \"LIKE\": true, \"NOT_LIKE\": true,\n  \"AND\": true, \"OR\": true, \"IN\": true, \"NOT_IN\": true, \"BETWEEN\": true,\n}\nif !supported[cond.Operator] {\n  return fmt.Errorf(\"operator %q not supported\", cond.Operator)\n}","typeGuard":null,"tryCatchPattern":"res, err := f.Convert(ctx, cond)\nif err != nil {\n  var unsupported bool = strings.Contains(err.Error(), \"unsupported operator\")\n  if unsupported { return nil, fmt.Errorf(\"bad operator in filter: %w\", err) }\n  return nil, err\n}","preventionTips":["Reference operator constants from this package instead of string literals","Keep a single operator mapping when porting between backends","Add a switch-exhaustiveness test over supported operators"],"tags":["milvus","filter","unsupported-operator"],"backgroundTag":"unsupported-operator","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}