@Override
    protected void onDeserialize(Deserializer buf) {
        super.onDeserialize(buf);
        id = (ResultNode)deserializeOptional(buf);
        rank = buf.getDouble(null);
        orderByIdx = List.of();
        int orderByCount = buf.getInt(null);
        if (orderByCount > 0) {
            Integer [] idxes = new Integer[orderByCount];
            for (int i = 0; i < orderByCount; i++) {
                idxes[i] = buf.getInt(null);
            }
            orderByIdx = List.of(idxes);
        }
        int numResults = buf.getInt(null);
        if (numResults > 0) {
            AggregationResult [] results = new AggregationResult[numResults];
            for (int i = 0; i < numResults; i++) {
                results[i] = (AggregationResult) deserializeOptional(buf);
            }
            aggregationResults = List.of(results);
        } else {
            aggregationResults = List.of();
        }
        int numExpressionResults = buf.getInt(null);
        if (numExpressionResults > 0) {
            RefResolver resolver = new RefResolver(aggregationResults);
            ExpressionNode[] orderBy = new ExpressionNode[numExpressionResults];
            for (int i = 0; i < numExpressionResults; i++) {
                ExpressionNode exp = (ExpressionNode) deserializeOptional(buf);
                exp.select(REF_LOCATOR, resolver);
                orderBy[i] = exp;
            }
            aggregationResults = resolver.results;
            orderByExp = List.of(orderBy);
        } else {
            orderByExp = List.of();
        }
        int numGroups = buf.getInt(null);
        if (numGroups > 0) {
            Group [] groups = new Group[numGroups];
            for (int i = 0; i < numGroups; i++) {
                Group g = new Group();
                g.deserializeWithId(buf);
                groups[i] = g;
            }
            children = List.of(groups);
        } else {
            children = List.of();
        }
        tag = buf.getInt(null);
    }
Adds an order-by expression to this group. If the expression is an AggregationResult, it will be added to the
list of this group's AggregationResults, and a reference to that expression is added instead. If the
AggregationResult is already present, a reference to THAT result is created instead.

@param exp the result to add
@param asc true to sort ascending, false to sort descending
@return this, to allow chaining
searchlib/src/main/java/com/yahoo/searchlib/aggregation/Group.java