SMILA 1.0 API documentation

org.eclipse.smila.solr.admin
Class SolrHttpAdmin

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

public class SolrHttpAdmin
extends SolrBaseAdmin

The SolrHttpAdmin class.

Author:
pwissel

Field Summary
 
Fields inherited from class org.eclipse.smila.solr.admin.SolrBaseAdmin
_helper, _log
 
Constructor Summary
SolrHttpAdmin(SolrHelper helper, SolrServers servers)
          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 targetCoreName)
          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.util.List<java.lang.String> getCoreNames()
          get all names of cores available in this server.
 java.lang.String merge(java.lang.String coreName, java.lang.String indexPath1, java.lang.String indexPath2)
          Action merge.
protected  java.util.List<java.lang.String> readFieldNames(java.lang.String coreName)
          actually read field names for given core.
 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, clearCoreCache, clearCoreCaches, getFieldNames, getServers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SolrHttpAdmin

public SolrHttpAdmin(SolrHelper helper,
                     SolrServers servers)
Constructor.

Parameters:
helper - the SolrHelper.
Method Detail

alias

public java.lang.String alias(java.lang.String coreName,
                              java.lang.String aliasName)
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

Returns:
the response message.
See Also:
org.eclipse.smila.solr.SolrAdminBase#alias(java.lang.String, java.lang.String)

create

public java.lang.String create(java.lang.String coreName,
                               java.lang.String instanceDir,
                               java.lang.String dataDir)
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.
See Also:
SolrAdmin.create(java.lang.String, java.lang.String, java.lang.String)

create

public java.lang.String create(java.lang.String srcCore,
                               java.lang.String targetCoreName)
                        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.

Returns:
the response message.
Throws:
java.lang.Exception
See Also:
SolrAdmin.create(java.lang.String, java.lang.String)

merge

public java.lang.String merge(java.lang.String coreName,
                              java.lang.String indexPath1,
                              java.lang.String indexPath2)
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.
indexPath1 - the first source index directory.
indexPath2 - the second source index directory.
Returns:
the response message.
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)
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.

Returns:
the response message.
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)
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

Returns:
the response message.
See Also:
org.eclipse.smila.solr.SolrAdminBase#rename(java.lang.String, java.lang.String)

status

public java.lang.String status(java.lang.String coreName)
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

Returns:
the response message.
See Also:
org.eclipse.smila.solr.SolrAdminBase#status(java.lang.String)

unload

public java.lang.String unload(java.lang.String coreName)
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

Returns:
the response message.
See Also:
org.eclipse.smila.solr.SolrAdminBase#unload(java.lang.String)

getCoreNames

public java.util.List<java.lang.String> getCoreNames()
                                              throws java.lang.Exception
Description copied from interface: SolrAdmin
get all names of cores available in this server.

Throws:
java.lang.Exception

readFieldNames

protected java.util.List<java.lang.String> readFieldNames(java.lang.String coreName)
                                                   throws SolrServerException,
                                                          java.io.IOException
Description copied from class: SolrBaseAdmin
actually read field names for given core.

Specified by:
readFieldNames in class SolrBaseAdmin
Throws:
SolrServerException
java.io.IOException

SMILA 1.0 API documentation