def compare_search_results(self, expected, actual, ignore_fields=None):
        """
        Compare search results while ignoring order of items in hits and specific fields.

        Args:
            expected (dict): Expected search result
            actual (dict): Actual search result
            ignore_fields (list): Fields to ignore in comparison (e.g. ['processingTimeMs'])

        Returns:
            bool: True if results match ignoring order, False otherwise
        """
        if ignore_fields is None:
            ignore_fields = ['processingTimeMs', 'query', 'limit', 'offset']

        # Create copies and remove ignored fields
        expected_copy = expected.copy()
        actual_copy = actual.copy()

        for field in ignore_fields:
            expected_copy.pop(field, None)
            actual_copy.pop(field, None)

        # Get hits from both results
        expected_hits = expected_copy.pop('hits', [])
        actual_hits = actual_copy.pop('hits', [])

        # Compare non-hits parts
        if expected_copy != actual_copy:
            return False

        # Convert hits to tuples of sorted items for comparison
        def hit_to_comparable(hit):
            def convert_value(v):
                if isinstance(v, dict):
                    # Convert dictionary to sorted tuple of (key, converted_value) pairs
                    return tuple(sorted((k, convert_value(val)) for k, val in v.items()))
                elif isinstance(v, list):
                    # Convert list to tuple of converted values
                    return tuple(sorted(convert_value(x) for x in v))
                return v

            # Convert the hit dictionary into a sorted tuple of (key, converted_value) pairs
            return tuple(sorted(
                (k, convert_value(v))
                for k, v in hit.items()
            ))

        # Convert hits to sets of comparable tuples
        expected_set = {hit_to_comparable(hit) for hit in expected_hits}
        actual_set = {hit_to_comparable(hit) for hit in actual_hits}

        return expected_set == actual_set

        Compare search results while ignoring order of items in hits and specific fields.

        Args:
            expected (dict): Expected search result
            actual (dict): Actual search result
            ignore_fields (list): Fields to ignore in comparison (e.g. ['processingTimeMs'])

        Returns:
            bool: True if results match ignoring order, False otherwise
        
tests/compatibility_tests/recommend/test_recommend.py