@Override
        public Result search(Query query, Execution execution) {
            Query queryA = query.clone();
            queryA.getModel().setRestrict("typeA");
            Result resultA = execution.search(queryA);

            Query queryB = query.clone();
            queryB.getModel().setRestrict("typeB");
            Result resultB = execution.search(queryB);

            Result mergedResult = new Result(query);
            mergedResult.mergeWith(resultA);
            mergedResult.hits().addAll(resultA.hits().asUnorderedHits());
            mergedResult.mergeWith(resultB);
            mergedResult.hits().addAll(resultB.hits().asUnorderedHits());

            return mergedResult;
        }
Simulate multiple document types returning a grouping result
container-search/src/test/java/com/yahoo/search/grouping/vespa/GroupingExecutorTestCase.java