{"record":{"id":"4d93dc58b5289947","repo":"Tencent/WeKnora","slug":"unsupported-comparison-operator-s","errorCode":null,"errorMessage":"unsupported comparison operator: %s","messagePattern":"unsupported comparison operator: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/repository/retriever/milvus/filter.go","lineNumber":86,"sourceCode":"\ntype filter struct{}\n\nfunc (c *filter) Convert(cond *universalFilterCondition) (*convertResult, error) {\n\tvar counter int\n\treturn c.convertCondition(cond, &counter)\n}\n\nfunc (c *filter) convertComparisonCondition(\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\toperator, ok := comparisonOperators[cond.Operator]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unsupported comparison operator: %s\", cond.Operator)\n\t}\n\n\tparamName := c.convertParamName(cond.Field, counter)\n\treturn &convertResult{\n\t\texprStr: fmt.Sprintf(\"%s %s {%s}\", condField, operator, paramName),\n\t\tparams:  map[string]any{paramName: cond.Value},\n\t}, nil\n}\n\nfunc (c *filter) convertLogicalCondition(\n\tcond *universalFilterCondition,\n\tcounter *int,\n) (*convertResult, error) {\n\tif cond.Value == nil {\n\t\treturn nil, fmt.Errorf(\"milvus filter condition is nil\")\n\t}\n\tconds, ok := cond.Value.([]*universalFilterCondition)\n\tif !ok {","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/repository/retriever/milvus/filter.go#L68-L104","documentation":"convertComparisonCondition looks up cond.Operator in the comparisonOperators map and returns 'unsupported comparison operator: %s' when the operator has no Milvus expression translation. Only operators present in that map (e.g. ==, !=, >, <, in) are supported; anything else cannot be rendered into a Milvus boolean expression.","triggerScenarios":"Passing an operator like 'contains', 'like', '~=', 'startsWith', or a database-specific SQL operator that the map does not cover, often when translating a filter DSL written for another vector store (e.g. Pinecone/Postgres) directly to Milvus.","commonSituations":"Cross-store filter DSLs reused between retrievers; frontend sending free-text operators; new operator added to the universal filter type without extending comparisonOperators; case mismatch ('IN' vs 'in').","solutions":["Check the operator value in the error and replace it with one supported by comparisonOperators (==, !=, >, >=, <, <=, in, etc.).","If the semantic operator is needed, add a mapping entry translating it to a Milvus-supported expression (e.g. use text_match or range expressions).","Normalize operator casing/aliases at the filter-parse boundary before conversion.","Validate the operator against a whitelist in the caller before building conditions."],"exampleFix":"// before\nnewCond(\"title\", \"contains\", title) // 'contains' unsupported\n// after\nnewCond(\"title\", \"in\", []string{\"prefix...\"}) // or extend comparisonOperators with a text_match mapping","handlingStrategy":"validation","validationCode":"var supportedOps = map[string]bool{\"==\":true,\"!=\":true,\">\":true,\">=\":true,\"<\":true,\"<=\":true,\"in\":true}\nif !supportedOps[cond.Operator] { return fmt.Errorf(\"operator %q not supported for milvus\", cond.Operator) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Normalize operator casing and aliases at the filter-parse boundary.","Whitelist operators per backend when sharing a filter DSL across stores.","Extend comparisonOperators deliberately when adding new operators, with tests.","Reject unsupported operators at the API surface rather than deep in conversion."],"tags":["milvus","go","filter","unsupported-operator"],"backgroundTag":"unsupported-filter-operator","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}