{"record":{"id":"6a9f9f5b8adb6f4b","repo":"zylon-ai/private-gpt","slug":"hybrid-search-is-not-enabled-please-build-the-que","errorCode":null,"errorMessage":"Hybrid search is not enabled. Please build the query with `enable_hybrid=True` in the constructor.","messagePattern":"Hybrid search is not enabled\\. Please build the query with `enable_hybrid=True` in the constructor\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/vector_store/patched_qdrant_store.py","lineNumber":1037,"sourceCode":"        Args:\n            query (VectorStoreQuery): query\n            **kwargs: additional keyword arguments to pass to the query\n\n        \"\"\"\n        query_embedding = cast(list[float], query.query_embedding)\n\n        with_payload = kwargs.pop(\"with_payload\", True)\n        with_vector = kwargs.pop(\"with_vectors\", False)\n        score_threshold = kwargs.pop(\"score_threshold\", None)\n\n        qdrant_filters = kwargs.get(\"qdrant_filters\")\n        if qdrant_filters is not None:\n            query_filter = qdrant_filters\n        else:\n            query_filter = cast(Filter, self._build_query_filter(query))\n\n        if query.mode == VectorStoreQueryMode.HYBRID and not self.enable_hybrid:\n            raise ValueError(\n                \"Hybrid search is not enabled. Please build the query with \"\n                \"`enable_hybrid=True` in the constructor.\"\n            )\n        elif (\n            query.mode == VectorStoreQueryMode.HYBRID\n            and self.enable_hybrid\n            and self._sparse_query_fn is not None\n            and query.query_str is not None\n        ):\n            sparse_indices, sparse_embedding = self._sparse_query_fn(\n                [query.query_str],\n            )\n            sparse_top_k = query.sparse_top_k or query.similarity_top_k\n\n            sparse_response = self._client.query_batch_points(\n                collection_name=self.collection_name,\n                requests=[\n                    rest.QueryRequest(","sourceCodeStart":1019,"sourceCodeEnd":1055,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/vector_store/patched_qdrant_store.py#L1019-L1055","documentation":"ValueError raised by the synchronous query path of PatchedQdrantVectorStore when a query is issued with VectorStoreQueryMode.HYBRID but the store was constructed with enable_hybrid=False. Hybrid search requires named dense+sparse vectors configured at collection build time, which only happens when enable_hybrid=True, so it cannot be toggled per query.","triggerScenarios":"Constructing the store without enable_hybrid=True (legacy unnamed-vector layout, see LEGACY_UNNAMED_VECTOR branch) and then calling query() with query.mode = VectorStoreQueryMode.HYBRID.","commonSituations":"Adding a hybrid query to code that reuses an existing store built for dense-only search; enabling hybrid in retrieval settings but not in the vector store factory settings; legacy collections created before hybrid support.","solutions":["Rebuild/reconfigure the store with enable_hybrid=True in the constructor (this also sets dense/sparse vector names and re-initializes the collection layout)","Or query with a non-hybrid mode (DEFAULT/SPARSE as supported) on a dense-only store","Recreate the Qdrant collection if it predates named-vector hybrid layout"],"exampleFix":"# before\nstore = PatchedQdrantVectorStore(collection_name=\"docs\")\nres = store.query(Query(mode=VectorStoreQueryMode.HYBRID, ...))\n# after\nstore = PatchedQdrantVectorStore(collection_name=\"docs\", enable_hybrid=True)\nres = store.query(Query(mode=VectorStoreQueryMode.HYBRID, ...))","handlingStrategy":"validation","validationCode":"def assert_hybrid_capable(store) -> None:\n    if not getattr(store, \"enable_hybrid\", False):\n        raise ValueError(\"store built without enable_hybrid=True; cannot run HYBRID queries\")","typeGuard":"def store_supports_hybrid(store: object) -> bool:\n    return bool(getattr(store, \"enable_hybrid\", False))","tryCatchPattern":"try:\n    res = store.query(q)\nexcept ValueError as e:\n    if \"Hybrid search is not enabled\" in str(e):\n        # rebuild store with enable_hybrid=True or downgrade query mode\n        raise","preventionTips":["Construct the store with enable_hybrid=True if any caller may issue hybrid queries","Feature-flag hybrid retrieval on store.enable_hybrid, not just retrieval settings","Plan collection migrations when moving from legacy unnamed vectors to named dense/sparse"],"tags":["qdrant","vector-store","hybrid-search","configuration"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}