SMILA (incubation) API documentation

org.eclipse.smila.solr.admin
Class SolrEmbeddedAdmin

java.lang.Object
  extended by org.eclipse.smila.solr.admin.SolrBaseAdmin
      extended by org.eclipse.smila.solr.admin.SolrEmbeddedAdmin
All Implemented Interfaces:
SolrAdmin

public class SolrEmbeddedAdmin
extends SolrBaseAdmin

The SolrEmbeddedAdmin class.

Author:
pwissel

Field Summary
 
Fields inherited from class org.eclipse.smila.solr.admin.SolrBaseAdmin
_helper, _log
 
Constructor Summary
SolrEmbeddedAdmin(SolrHelper helper, CoreContainer container)
          Constructor.
 
Method Summary
 java.lang.String alias(java.lang.String coreName, java.lang.String aliasName)
          Action alias.
 java.lang.String create(java.lang.String srcCore, java.lang.String targetCore)
          copies the definition of the source core and creates the new target core for it in the default location.
 java.lang.String create(java.lang.String coreName, java.lang.String instanceDir, java.lang.String dataDir)
          Action create.
 java.lang.String merge(java.lang.String coreName, java.lang.String indexDir1, java.lang.String indexDir2)
          Action merge.
 java.lang.String reload(java.lang.String coreName)
          Action reload.
 java.lang.String rename(java.lang.String coreName, java.lang.String newName)
          Action rename.
 java.lang.String status(java.lang.String coreName)
          Action status.
 java.lang.String unload(java.lang.String coreName)
          Removes a core from solr.
 
Methods inherited from class org.eclipse.smila.solr.admin.SolrBaseAdmin
buildAdminParams
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SolrEmbeddedAdmin

public SolrEmbeddedAdmin(SolrHelper helper,
                         CoreContainer container)
Constructor.

Parameters:
helper - the SolrHelper.
container - the CoreContainer.
Method Detail

alias

public java.lang.String alias(java.lang.String coreName,
                              java.lang.String aliasName)
                       throws java.lang.Exception
Action alias. (Experimental) Adds an additional name for a core. The example below allows access to the same core via the names "core0" and "corefoo". http://localhost:8983/solr/admin/cores?action=ALIAS&core=core0&other=corefoo

Parameters:
coreName - the core name.
aliasName - the alias name.
Returns:
the response message.
Throws:
java.lang.Exception - Exception.
See Also:
org.eclipse.smila.solr.SolrAdminBase#alias(java.lang.String, java.lang.String)

create

public java.lang.String create(java.lang.String srcCore,
                               java.lang.String targetCore)
                        throws java.lang.Exception
copies the definition of the source core and creates the new target core for it in the default location.

Only supported in embedded mode.

Parameters:
srcCore - the src core
targetCore - the target core name
Returns:
the response message.
Throws:
java.lang.Exception - Exception.
See Also:
org.eclipse.smila.solr.admin.SolrAdmin#create(java.lang.String)

create

public java.lang.String create(java.lang.String coreName,
                               java.lang.String instanceDir,
                               java.lang.String dataDir)
                        throws java.lang.Exception
Action create. Creates a new core based on preexisting instanceDir/solrconfig.xml/schema.xml, and registers it. If persistence is enabled (persist=true), the configuration for this new core will be saved in 'solr.xml'. If a core with the same name exists, while the "new" created core is initalizing, the "old" one will continue to accept requests. Once it has finished, all new request will go to the "new" core, and the "old" core will be unloaded. http://localhost:8983/solr/admin/cores?action=CREATE&name=coreX&instanceDir=path_to_instance_directory&config= config_file_name.xml&schema=schem_file_name.xml&dataDir=data instanceDir is a required parameter. config, schema & dataDir parameters are optional. (Default is to look for solrconfig.xml/schema.xml inside instanceDir. Default place to look for dataDir depends on solrconfig.xml.)

Parameters:
coreName - the core name.
instanceDir - the instance directory.
dataDir - the data directory.
Returns:
the response message.
Throws:
java.lang.Exception - Exception.
See Also:
SolrAdmin.create(java.lang.String, java.lang.String, java.lang.String)

merge

public java.lang.String merge(java.lang.String coreName,
                              java.lang.String indexDir1,
                              java.lang.String indexDir2)
                       throws java.lang.Exception
Action merge. CoreAdminHandler now supports merging one or more indexes into another index (since Solr 1.4). http://localhost:8983/solr/admin/cores?action=mergeindexes&core=core0&indexDir=/opt/solr/core1/data/index&indexDir= /opt/solr/core2/data/index The above command will merge the indexes of core1 and core2 into core0. The path for this command is the 'adminPath' defined in solr.xml (default is /admin/cores). Before executing this command, one must make sure to call commit on core1 and core2 (in order to close IndexWriter) and no writes should happen on core1 and core2 until the merge command completes. Failure to do so may corrupt the core0 index. Once the merge is completed, a commit should be called on core0 to make the changes visible to searchers. NOTE: In this example core0 must exist and have a compatible schema with core1 and core2. The 'mergeindexes' command will not create a new core named 'core0' if it does not already exist.

Parameters:
coreName - the target core name.
indexDir1 - the first source index directory.
indexDir2 - the second source index directory.
Returns:
the response message.
Throws:
java.lang.Exception - Exception.
See Also:
org.eclipse.smila.solr.SolrAdminBase#merge(java.lang.String, java.lang.String, java.lang.String)

reload

public java.lang.String reload(java.lang.String coreName)
                        throws java.lang.Exception
Action reload. Load a new core from the same configuration as an existing registered core. While the "new" core is initalizing, the "old" one will continue to accept requests. Once it has finished, all new request will go to the "new" core, and the "old" core will be unloaded. http://localhost:8983/solr/admin/cores?action=RELOAD&core=core0 This can be useful when (backwards compatible) changes have been made to your solrconfig.xml or schema.xml files (ie: new declarations, changed default params for a , etc...) and you want to start using them without stopping and restarting your whole Servlet Container.

Parameters:
coreName - the core name.
Returns:
the response message.
Throws:
java.lang.Exception - Exception.
See Also:
org.eclipse.smila.solr.SolrAdminBase#reload(java.lang.String)

rename

public java.lang.String rename(java.lang.String coreName,
                               java.lang.String newName)
                        throws java.lang.Exception
Action rename. Change the names used to access a core. The example below changes the name of the core from "core0" to "core5". http://localhost:8983/solr/admin/cores?action=RENAME&core=core0&other=core5

Parameters:
coreName - the core name.
newName - the new core name
Returns:
the response message.
Throws:
java.lang.Exception - Exception.
See Also:
org.eclipse.smila.solr.SolrAdminBase#rename(java.lang.String, java.lang.String)

status

public java.lang.String status(java.lang.String coreName)
                        throws java.lang.Exception
Action status. Get the status for a given core or all cores if no core is specified: http://localhost:8983/solr/admin/cores?action=STATUS&core=core0 http://localhost:8983/solr/admin/cores?action=STATUS

Parameters:
coreName - the core name.
Returns:
the response message.
Throws:
java.lang.Exception - Exception.
See Also:
org.eclipse.smila.solr.SolrAdminBase#status(java.lang.String)

unload

public java.lang.String unload(java.lang.String coreName)
                        throws java.lang.Exception
Removes a core from solr. Existing requests will continue to be processed, but no new requests can be sent to this core by the name. If a core is registered under more than one name, only that specific mapping is removed. http://localhost:8983/solr/admin/cores?action=UNLOAD&core=core0

Parameters:
coreName - the core name.
Returns:
the response message.
Throws:
java.lang.Exception - Exception.
See Also:
org.eclipse.smila.solr.SolrAdminBase#unload(java.lang.String)

SMILA (incubation) API documentation