public RootGroup getResultGroup(Result result) {
        Hit root = result.hits().get(new URI(new RootId(getRequestId()).toString()), -1);
        if ( ! (root instanceof RootGroup)) {
            return null;
        }
        return (RootGroup)root;
    }
Returns the root result {@link RootGroup} that corresponds to this request. This is not available until the
search returns. Because searchers are allowed to modify both {@link Result} and {@link Hit} objects freely, this
method requires that you pass it the current {@link Result} object as argument.

@param result the search result that contains the root group.
@return the result {@link RootGroup} of this request, or null if not found.
container-search/src/main/java/com/yahoo/search/grouping/GroupingRequest.java