def build_group_parameters(field_config) -> str:
            """Build the max and order parameters for a group."""
            parts = []

            # Add max results if specified
            if field_config.max_results is not None:
                parts.append(f"max({field_config.max_results})")
            elif global_max_results:
                parts.append(f"max({global_max_results})")

            # Add sort order if specified
            if field_config.order:
                prefix = '-' if field_config.order == 'desc' else ''
                parts.append(f"order({prefix}count())")
            elif global_sort_order:
                prefix = '-' if global_sort_order == 'desc' else ''
                parts.append(f"order({prefix}count())")
            else:
                parts.append("order(-count())")

            return " ".join(parts)
Build the max and order parameters for a group.
src/marqo/core/semi_structured_vespa_index/semi_structured_vespa_index.py