{"record":{"id":"c1b362771e4c4d7d","repo":"cocoindex-io/cocoindex","slug":"unsupported-qdrant-sparse-vector-modifier-modifi","errorCode":null,"errorMessage":"Unsupported Qdrant sparse vector modifier: {modifier}","messagePattern":"Unsupported Qdrant sparse vector modifier: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/cocoindex/connectors/qdrant/_target.py","lineNumber":685,"sourceCode":"\n\ndef _multivector_comparator(\n    comparator: str,\n) -> qdrant_models.MultiVectorComparator:\n    \"\"\"Convert multivector comparator string to Qdrant enum.\"\"\"\n    if comparator.lower() == \"max_sim\":\n        return qdrant_models.MultiVectorComparator.MAX_SIM\n    raise ValueError(f\"Unsupported multivector comparator: {comparator}\")\n\n\ndef _sparse_modifier_from_spec(\n    modifier: Literal[\"idf\"] | None,\n) -> qdrant_models.Modifier | None:\n    if modifier is None:\n        return None\n    if modifier == \"idf\":\n        return qdrant_models.Modifier.IDF\n    raise ValueError(f\"Unsupported Qdrant sparse vector modifier: {modifier}\")\n\n\ndef _vector_params_from_def(\n    vector_def: _ResolvedQdrantVectorDef,\n) -> qdrant_models.VectorParams:\n    \"\"\"Convert a resolved vector definition to Qdrant VectorParams.\"\"\"\n    resolved_schema = vector_def.schema\n    multivector_config = None\n\n    if isinstance(resolved_schema, res_schema.VectorSchema):\n        dim = resolved_schema.size\n    elif isinstance(resolved_schema, res_schema.MultiVectorSchema):\n        dim = resolved_schema.vector_schema.size\n        # For multivector, use the specified comparator\n        multivector_config = qdrant_models.MultiVectorConfig(\n            comparator=_multivector_comparator(vector_def.multivector_comparator)\n        )\n    else:","sourceCodeStart":667,"sourceCodeEnd":703,"githubUrl":"https://github.com/cocoindex-io/cocoindex/blob/e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b/python/cocoindex/connectors/qdrant/_target.py#L667-L703","documentation":"For sparse vectors, Qdrant supports an optional modifier; the connector accepts only \"idf\" (inverse document frequency) or None. Any other modifier value on QdrantSparseVectorDef raises this ValueError when sparse vector params are built.","triggerScenarios":"Setting `modifier=` on QdrantSparseVectorDef to a value other than None or \"idf\" (e.g. \"IDF\" uppercase — matching is exact here — \"bm25\", or \"none\"); triggered via _sparse_vector_params_from_def during collection creation.","commonSituations":"Assuming case-insensitive matching (unlike the comparator helper, this one is exact, so \"IDF\" fails); copying modifier names from other engines; using a placeholder like \"none\" instead of omitting the field.","solutions":["Set modifier=\"idf\" (exact lowercase) or omit it / pass None.","If you typed \"IDF\" or \"Idf\", lowercase it.","If you don't want IDF weighting, delete the modifier field rather than passing \"none\"."],"exampleFix":"// before\nQdrantSparseVectorDef(modifier=\"IDF\")\n// after\nQdrantSparseVectorDef(modifier=\"idf\")","handlingStrategy":"validation","validationCode":"assert modifier in (None, \"idf\"), f\"modifier must be None or 'idf', got {modifier!r}\"","typeGuard":"modifier is None or modifier == \"idf\"","tryCatchPattern":"try:\n    schema = await CollectionSchema.create(vectors={\"sparse\": QdrantSparseVectorDef(modifier=mod)})\nexcept ValueError as e:\n    raise ConfigError(f\"sparse modifier invalid: {e}\") from None","preventionTips":["Use exact lowercase \"idf\" — this check is case-sensitive.","Omit the modifier field rather than passing \"none\" or \"\".","Validate sparse config values when loading from YAML/JSON."],"tags":["qdrant","sparse-vectors","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b","analyzedAt":"2026-09-08T15:59:19.997Z","contentChangedAt":"2026-09-08T15:59:19.997Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}