{"record":{"id":"f9f7f6d92b05044a","repo":"apache/beam","slug":"not-supported-search-strategy-yet-self-search-strategy","errorCode":null,"errorMessage":"Not supported search strategy yet: {self.search_strategy}","messagePattern":"Not supported search strategy yet: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/ml/rag/enrichment/milvus_search.py","lineNumber":461,"sourceCode":"          partition_names=self.partition_names,\n          output_fields=self.output_fields,\n          timeout=self.timeout,\n          round_decimal=self.round_decimal,\n          data=data,\n          **vector_search_params)\n    elif isinstance(self.search_strategy, KeywordSearchParameters):\n      data = list(map(self._get_keyword_search_data, embeddable_items))\n      keyword_search_params = unpack_dataclass_with_kwargs(self.search_strategy)\n      return self._client.search(\n          collection_name=self.collection_name,\n          partition_names=self.partition_names,\n          output_fields=self.output_fields,\n          timeout=self.timeout,\n          round_decimal=self.round_decimal,\n          data=data,\n          **keyword_search_params)\n    else:\n      raise ValueError(\n          f\"Not supported search strategy yet: {self.search_strategy}\")\n\n  def _get_hybrid_search_data(self, embeddable_items: list[EmbeddableItem]):\n    vector_search_data = list(\n        map(self._get_vector_search_data, embeddable_items))\n    keyword_search_data = list(\n        map(self._get_keyword_search_data, embeddable_items))\n\n    vector_search_req = AnnSearchRequest(\n        data=vector_search_data,\n        anns_field=self.search_strategy.vector.anns_field,\n        param=self.search_strategy.vector.search_params,\n        limit=self.search_strategy.vector.limit,\n        expr=self.search_strategy.vector.filter)\n\n    keyword_search_req = AnnSearchRequest(\n        data=keyword_search_data,\n        anns_field=self.search_strategy.keyword.anns_field,","sourceCodeStart":443,"sourceCodeEnd":479,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/ml/rag/enrichment/milvus_search.py#L443-L479","documentation":"MilvusEnricher._search_documents dispatches on the configured search_strategy type (vector / keyword / hybrid). This error is thrown when the strategy object is of a type the enricher does not recognize, so no branch matches and it raises a ValueError.","triggerScenarios":"Passing a custom or unrecognized search strategy object to MilvusSearchParameters and then calling the enricher (via __call__), which reaches _search_documents with an unsupported strategy type.","commonSituations":"Implementing a custom strategy subclass not yet supported by the pipeline; version mismatch where a strategy type exists in a newer beam but the runtime has an older one; typo'd imports picking the wrong class.","solutions":["Use one of the supported strategies: VectorSearchStrategy, KeywordSearchStrategy, or HybridSearchStrategy","Check the installed apache_beam version supports the strategy type you pass","If a custom strategy is needed, extend _search_documents to handle it before use"],"exampleFix":"// before\nparams = MilvusSearchParameters(collection_name='c', search_strategy=MyCustomStrategy())\n// after\nparams = MilvusSearchParameters(collection_name='c', search_strategy=HybridSearchStrategy(embedding_fn=fn))","handlingStrategy":"type-guard","validationCode":"SUPPORTED = (VectorSearchStrategy, KeywordSearchStrategy, HybridSearchStrategy)\nassert isinstance(params.search_strategy, SUPPORTED), 'unsupported strategy'","typeGuard":"def is_supported_strategy(s) -> bool:\n    return isinstance(s, (VectorSearchStrategy, KeywordSearchStrategy, HybridSearchStrategy))","tryCatchPattern":"try:\n    result = enricher(batch)\nexcept ValueError as e:\n    if str(e).startswith('Not supported search strategy'): log_and_skip_batch(batch)\n    else: raise","preventionTips":["Only use the three built-in strategy classes","Pin apache_beam version and check strategy support in release notes","Add an isinstance assertion in pipeline construction tests"],"tags":["python","apache-beam","milvus","rag","unsupported"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}