{"record":{"id":"a35214575f35186d","repo":"microsoft/graphrag","slug":"unsupported-operator-for-azure-ai-search-cond-op","errorCode":null,"errorMessage":"Unsupported operator for Azure AI Search: {cond.operator}","messagePattern":"Unsupported operator for Azure AI Search: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/graphrag-vectors/graphrag_vectors/azure_ai_search.py","lineNumber":251,"sourceCode":"            case Operator.lte:\n                return f\"{field} le {quote(value)}\"\n            case Operator.in_:\n                items = \" or \".join(f\"{field} eq {quote(v)}\" for v in value)\n                return f\"({items})\"\n            case Operator.not_in:\n                items = \" and \".join(f\"{field} ne {quote(v)}\" for v in value)\n                return f\"({items})\"\n            case Operator.contains:\n                return f\"search.ismatch('{value}', '{field}')\"\n            case Operator.startswith:\n                return f\"search.ismatch('{value}*', '{field}')\"\n            case Operator.endswith:\n                return f\"search.ismatch('*{value}', '{field}')\"\n            case Operator.exists:\n                return f\"{field} ne null\" if value else f\"{field} eq null\"\n            case _:\n                msg = f\"Unsupported operator for Azure AI Search: {cond.operator}\"\n                raise ValueError(msg)\n\n    def _extract_data(\n        self, doc: dict[str, Any], select: list[str] | None = None\n    ) -> dict[str, Any]:\n        \"\"\"Extract additional field data from a document response.\"\"\"\n        fields_to_extract = select if select is not None else list(self.fields.keys())\n        return {\n            field_name: doc[field_name]\n            for field_name in fields_to_extract\n            if field_name in doc\n        }\n\n    def similarity_search_by_vector(\n        self,\n        query_embedding: list[float],\n        k: int = 10,\n        select: list[str] | None = None,\n        filters: FilterExpr | None = None,","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/microsoft/graphrag/blob/f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704/packages/graphrag-vectors/graphrag_vectors/azure_ai_search.py#L233-L269","documentation":"_compile_condition translates each Operator enum member to OData/search syntax for Azure AI Search; the default case raises when the condition uses an Operator this backend never implemented. The supported set ends with exists — anything newer (or backend-inappropriate) is unsupported.","triggerScenarios":"Passing a Condition whose operator is defined in the shared Operator enum but not handled by the Azure AI Search compiler (any member beyond the handled cases) — e.g. an operator added for another vector backend.","commonSituations":"Sharing filter code between LanceDB/Cosmos and Azure AI Search backends; upgrading graphrag-vectors which adds operators not yet implemented for azure_ai_search.","solutions":["Restrict filters for Azure AI Search to the implemented operators (eq/ne/gt/gte/lt/lte/in/startswith/endswith/exists per this version)","Rewrite the filter using supported primitives (e.g. combine two conditions with And instead of an exotic operator)","Check the installed graphrag-vectors changelog/source for newly supported operators and upgrade if implemented"],"exampleFix":"# before\nCondition(\"size\", Operator.between, (1, 10))\n# after\nAnd([Condition(\"size\", Operator.gte, 1), Condition(\"size\", Operator.lte, 10)])","handlingStrategy":"validation","validationCode":"SUPPORTED = {Operator.eq, Operator.ne, Operator.gt, Operator.gte, Operator.lt, Operator.lte, Operator.in_, Operator.startswith, Operator.endswith, Operator.exists}\nassert cond.operator in SUPPORTED","typeGuard":"def op_supported_for_azure(op: Operator) -> bool:\n    return op in {Operator.eq, Operator.ne, Operator.gt, Operator.gte, Operator.lt, Operator.lte, Operator.in_, Operator.startswith, Operator.endswith, Operator.exists}","tryCatchPattern":null,"preventionTips":["Keep a per-backend supported-operator set and validate filters before search","Don't share untested filter code across vector backends"],"tags":["azure-ai-search","filter","operator","vectors"],"backgroundTag":"unsupported-filter-expression","analyzedSha":"f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704","analyzedAt":"2026-08-27T11:16:29.677Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}