{"record":{"id":"5a2f1057fbaa9789","repo":"microsoft/qlib","slug":"please-implement-the-search-records-method","errorCode":null,"errorMessage":"Please implement the `search_records` method.","messagePattern":"Please implement the `search_records` method\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"qlib/workflow/exp.py","lineNumber":101,"sourceCode":"        Returns\r\n        -------\r\n        A recorder object.\r\n        \"\"\"\r\n        raise NotImplementedError(f\"Please implement the `create_recorder` method.\")\r\n\r\n    def search_records(self, **kwargs):\r\n        \"\"\"\r\n        Get a pandas DataFrame of records that fit the search criteria of the experiment.\r\n        Inputs are the search criteria user want to apply.\r\n\r\n        Returns\r\n        -------\r\n        A pandas.DataFrame of records, where each metric, parameter, and tag\r\n        are expanded into their own columns named metrics.*, params.*, and tags.*\r\n        respectively. For records that don't have a particular metric, parameter, or tag, their\r\n        value will be (NumPy) Nan, None, or None respectively.\r\n        \"\"\"\r\n        raise NotImplementedError(f\"Please implement the `search_records` method.\")\r\n\r\n    def delete_recorder(self, recorder_id):\r\n        \"\"\"\r\n        Create a recorder for each experiment.\r\n\r\n        Parameters\r\n        ----------\r\n        recorder_id : str\r\n            the id of the recorder to be deleted.\r\n        \"\"\"\r\n        raise NotImplementedError(f\"Please implement the `delete_recorder` method.\")\r\n\r\n    def get_recorder(self, recorder_id=None, recorder_name=None, create: bool = True, start: bool = False) -> Recorder:\r\n        \"\"\"\r\n        Retrieve a Recorder for user. When user specify recorder id and name, the method will try to return the\r\n        specific recorder. When user does not provide recorder id or name, the method will try to return the current\r\n        active recorder. The `create` argument determines whether the method will automatically create a new recorder\r\n        according to user's specification if the recorder hasn't been created before.\r","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/workflow/exp.py#L83-L119","documentation":"Experiment.search_records is an abstract method meant to return a pandas DataFrame of records (metrics.*, params.*, tags.* columns) matching search criteria. The base class raises NotImplementedError; only concrete backends such as MLflowExperiment implement it by forwarding filter_string/run_view_type/max_results/order_by to the MLflow client.","triggerScenarios":"Calling exp.search_records(...) on the base Experiment; R.search_records(experiment_ids, ...) when the configured exp_manager class delegates to an Experiment subclass lacking this override.","commonSituations":"Custom experiment backends that support run tracking but not search; probing the API in tests; version drift where a fork's subclass fell behind the abstract interface.","solutions":["Use the default MLflowExperiment, whose search_records maps kwargs to MlflowClient.search_runs.","Implement search_records(self, **kwargs) in your subclass returning a DataFrame of matched records.","For ad-hoc inspection, query your backend's native API directly instead of the abstract method."],"exampleFix":"# before\nExperiment('1', 'e').search_records()  # NotImplementedError\n\n# after\nR.search_records(experiment_ids=[exp_id], filter_string=\"metrics.ic > 0.02\")  # via MLflow backend","handlingStrategy":"type-guard","validationCode":"from qlib.workflow.exp import Experiment\nif exp.__class__.search_records is Experiment.search_records:\n    raise RuntimeError('backend cannot search records; use MLflow backend')","typeGuard":"def searchable(exp) -> bool:\n    from qlib.workflow.exp import Experiment\n    return exp.__class__.search_records is not Experiment.search_records","tryCatchPattern":null,"preventionTips":["Use R.search_records with the default MLflow manager.","Document which capabilities your custom backend supports and gate calls on them."],"tags":["qlib","abstract-method","not-implemented","search","mlflow"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}