/** * Creates a new core, associated with a collection, in Solr. */ public void createCore(String coreName, String collectionName, String configName, int numShards) throws IOException { createCore(coreName, collectionName, configName, numShards, null); }
/** * Create a Solr collection with a given number of shards. * * @param collectionName name of the collection to be created * @param configName name of the config for the collection * @param numShards number of shards in the collection */ public void createCollection(String collectionName, String configName, int numShards) throws IOException { for (int shardIndex = 0; shardIndex < numShards; shardIndex++) { String coreName = String.format("%s_shard%d", collectionName, shardIndex + 1); createCore(coreName, collectionName, configName, numShards, coreName + "_data"); } }