SOLR-803: fix CoreAdminRequest.createCore error

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@708266 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2008-10-27 18:21:56 +00:00
parent f05d6cac52
commit a1d7881ee7
2 changed files with 15 additions and 3 deletions

View File

@ -96,6 +96,8 @@ Bug Fixes
4. SOLR-805: DisMax queries are not being cached in QueryResultCache (Todd Feak via koji)
5. SOLR-803: CoreAdminRequest.createCore fails because name parameter isn't set (Sean Colombo via ryan)
Other Changes
----------------------

View File

@ -66,7 +66,7 @@ public class CoreAdminRequest extends SolrRequest
}
ModifiableSolrParams params = new ModifiableSolrParams();
params.set( CoreAdminParams.ACTION, action.toString() );
params.set( CoreAdminParams.CORE, core );
params.set( CoreAdminParams.NAME, core );
params.set( CoreAdminParams.INSTANCE_DIR, instanceDir);
if (configName != null) {
params.set( CoreAdminParams.CONFIG, configName);
@ -219,13 +219,24 @@ public class CoreAdminRequest extends SolrRequest
}
public static CoreAdminResponse createCore( String name, String instanceDir, SolrServer server ) throws SolrServerException, IOException
{
return CoreAdminRequest.createCore(name, instanceDir, server, null, null);
}
public static CoreAdminResponse createCore( String name, String instanceDir, SolrServer server, String configFile, String schemaFile ) throws SolrServerException, IOException
{
CoreAdminRequest.Create req = new CoreAdminRequest.Create();
req.setCoreName( name );
req.setInstanceDir(instanceDir);
if(configFile != null){
req.setConfigName(configFile);
}
if(schemaFile != null){
req.setSchemaName(schemaFile);
}
return req.process( server );
}
public static CoreAdminResponse persist(String fileName, SolrServer server) throws SolrServerException, IOException
{
CoreAdminRequest.Persist req = new CoreAdminRequest.Persist();
@ -233,4 +244,3 @@ public class CoreAdminRequest extends SolrRequest
return req.process(server);
}
}