def test_search(self):
        """Run search queries and compare the results with the stored results."""
        self.logger.info(f"Running test_search on {self.__class__.__name__}")
        stored_results = self.load_results_from_file()
        test_failures = [] #this stores the failures in the subtests. These failures could be assertion errors or any other types of exceptions

        for index in self.indexes_to_test_on:
            index_name = index['indexName']

            # For unstructured indexes, we add a new document, because we want to redeploy schema with
            # a new tensor + lexical field (behavior of semi-structured indexes 2.13.0 onwards).
            # This tests that redeploying the schema doesn't affect the search results.
            # TODO: Put this back.
            #if index.get("type") is None or index.get("type") == 'unstructured':
            #    self.client.index(index_name).add_documents(
            #        documents=[{"_id": "to_be_removed", "new_field": "randomwords,removefromresults"}],
            #        tensor_fields=["new_field"]
            #    )
            #    self.client.index(index_name).delete_documents(["to_be_removed"])

            # For each index, search for different queries and compare results
            for query, search_method, result_key in zip(self.queries, self.search_methods, self.result_keys):
                try:
                    if index.get("type") is not None and index.get("type") == 'structured':
                        if search_method == 'HYBRID':
                            result = self.client.index(index_name).search(q=query, search_method=search_method, hybrid_parameters=self.hybrid_search_params)
                        else:
                            result = self.client.index(index_name).search(q=query, search_method=search_method, searchable_attributes=self.searchable_attributes[search_method])
                    else:
                        result = self.client.index(index_name).search(q=query, search_method=search_method)

                    self._compare_search_results(stored_results[index_name][result_key], result)

                except Exception as e:
                    test_failures.append((query, search_method, index_name, traceback.format_exc()))

            if test_failures:
                failure_message = "\n".join([
                    f"Failure in query {query}, search_method {search_method}, idx: {idx} : {error}"
                    for query, search_method, idx, error in test_failures
                ])
                self.fail(f"Some subtests failed:\n{failure_message}")
Run search queries and compare the results with the stored results.
tests/compatibility_tests/search/test_search.py