private SearchDefinition unionOf(Collection<SearchDefinition> searchDefinitions) {
        SearchDefinition union = new SearchDefinition(IndexFacts.unionName);

        for (SearchDefinition sd : searchDefinitions) {
            for (Index index : sd.indices().values()) {
                union.getOrCreateIndex(index.getName());
                for (String command : index.allCommands())
                    union.addCommand(index.getName(), command);
                for (String alias : index.aliases()) {
                    try {
                        union.addAlias(alias, index.getName());
                    }
                    catch (IllegalArgumentException e) {
                        log.fine("Conflicting alias '" + alias  + " of " + index + " in " + sd +
                                 " will not take effect for queries which does not specify that search definition");
                    }
                }
            }

        }
        return union;
    }
Create an index model for a single search definition
container-search/src/main/java/com/yahoo/prelude/IndexModel.java