private static OptionalInt intProperty(Query q, CompoundName name) {
        Integer val = q.properties().getInteger(name);
        return val != null ? OptionalInt.of(val) : OptionalInt.empty();
    }
Creates a new grouping request and adds it to the query.getSelect().getGrouping() list

@param query the query to attach the request to.
@return The created request.
container-search/src/main/java/com/yahoo/search/grouping/GroupingRequest.java