private void addHitsFromSource(Source source,SectionHitGroup sectionGroup,Result result,List<String> sourceList) {
        if (source==Source.any) { // Add any source not added yet
            for (Hit hit : result.hits()) {
                if ( ! (hit instanceof HitGroup)) continue;
                String groupId=hit.getId().stringValue();
                if ( ! groupId.startsWith("source:")) continue;
                String sourceName=groupId.substring(7);
                if (sourceList.contains(sourceName)) continue;
                sectionGroup.addAll(((HitGroup)hit).asList());
                sourceList.add(sourceName); // Add *'ed sources explicitly
            }
        }
        else {
            HitGroup sourceGroup=(HitGroup)result.hits().get("source:" + source.getName());
            if (sourceGroup!=null)
                sectionGroup.addAll(sourceGroup.asList());
            sourceList.add(source.getName()); // Add even if not found - may be added later
        }
    }
Creates the hit group corresponding to a section, drawing data from the given result
container-search/src/main/java/com/yahoo/search/pagetemplates/engine/Organizer.java