You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2016/04/08 17:45:58 UTC

[Solr Wiki] Trivial Update of "Solr.xml (supported through 4.x)" by ShawnHeisey

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "Solr.xml (supported through 4.x)" page has been changed by ShawnHeisey:
https://wiki.apache.org/solr/Solr.xml%20%28supported%20through%204.x%29?action=diff&rev1=7&rev2=8

Comment:
deprecated in 4.4.  State this.

  ## page was renamed from Solr.xml (pre 5.x)
  = Solr.xml =
  
- '''''Deprecated and unsupported as of 5.0, see [[Solr.xml 4.4 and beyond]]'''''
+ '''''Deprecated in 4.4 and unsupported as of 5.0, see [[Solr.xml 4.4 and beyond]]'''''
  
- To enable support for dynamic !SolrCore administration, place a file named ''solr.xml'' in the solr.home 
+ To enable support for dynamic !SolrCore administration, place a file named ''solr.xml'' in the solr.home
  directory.  Here is an example ''solr.xml'' file:
  {{{
  <solr persistent="true" sharedLib="lib">
@@ -64, +64 @@

    * <!> [[Solr4.0]] '''hostContext''' - the host context of solr url.
    * <!> [[Solr4.0]] '''zkClientTimeout''' - Timeout for connection of zookeeper server. It's used for SolrCloud environment for ensure the connection status.
    * <!> [[Solr4.1]] '''transientCacheSize''' - The limit for the LRU cache of "lazily loaded" cores. More at [[LotsOfCores|LotsOfCores]]
-   * <!> [[Solr1.4]] '''adminHandler''' - FQN(Fully qualified name) of a class that  inherits from !CoreAdminHandler.  For example, adminHandler="com.myorg.!MyAdminHandler" would configure the custom admin handler (!MyAdminHandler) to handler admin requests ( as opposed to org.apache.solr.handler.admin.!CoreAdminHandler , that is the default admin handler if one is not specified ). To illustrate an use case for the same - suppose if there is a need to get some statistics from different cores in a solr instance - we would proceed as follows. 
+   * <!> [[Solr1.4]] '''adminHandler''' - FQN(Fully qualified name) of a class that  inherits from !CoreAdminHandler.  For example, adminHandler="com.myorg.!MyAdminHandler" would configure the custom admin handler (!MyAdminHandler) to handler admin requests ( as opposed to org.apache.solr.handler.admin.!CoreAdminHandler , that is the default admin handler if one is not specified ). To illustrate an use case for the same - suppose if there is a need to get some statistics from different cores in a solr instance - we would proceed as follows.
-    * Define a new action called 'mystat' that could be accessed from the client  as below. 
+    * Define a new action called 'mystat' that could be accessed from the client  as below.
     http://localhost:8983/solr/admin/cores?action=MYSTAT
     * <!> [[Solr4.0]] Note that to load up your custom handler, you may need to use the sharedLib attribute mentioned in the `<solr>` tag section.
     * Define the implementation of that action as
  
-  
+ 
  {{{
  import org.apache.solr.handler.admin.CoreAdminHandler ;
  
- class MyAdminHandler extends CoreAdminHandler { 
+ class MyAdminHandler extends CoreAdminHandler {
-     
+ 
    /**
     * @return true, if the changes need to be persisted by the CoreContainer. (use only if solr.xml would be changed because of this action. )
     *         false, otherwise.   (Use this if unsure or having a read-only access to the CoreContainer like collecting statistics)
-    * 
+    *
-    */ 
+    */
    protected boolean handleCustomAction(SolrQueryRequest req, SolrQueryResponse rsp) {
-      CoreContainer container = super.getCoreContainer(); 
+      CoreContainer container = super.getCoreContainer();
       SolrCore mycore1 = container.getCore("core1");
       SolrCore mycore2 = container.getCore("core2");
       SolrParams params = req.getParams();
       String a = params.get( CoreAdminParams.ACTION );
       if (a.equalsIgnoreCase("mystat"))  {
-          // TODO: populate 'rsp' as necessary. 
+          // TODO: populate 'rsp' as necessary.
-       } 
+       }
-   } 
+   }
  }
  }}}
  
    <!> [[Solr4.0]] Note that you may need to declare the two constructors for it to be instantiated successfully.
  
-   There are other methods in [[http://lucene.apache.org/solr/api/org/apache/solr/handler/admin/CoreAdminHandler.html|CoreAdminHandler]] that could be used to override default action-s, but for most of the common cases they would not be necessary but left best to the experts. 
+   There are other methods in [[http://lucene.apache.org/solr/api/org/apache/solr/handler/admin/CoreAdminHandler.html|CoreAdminHandler]] that could be used to override default action-s, but for most of the common cases they would not be necessary but left best to the experts.
  {{{
- class MyAdminHandler extends CoreAdminHandler { 
+ class MyAdminHandler extends CoreAdminHandler {
-     //Available for override , but unnecessary except for the rare case. 
+     //Available for override , but unnecessary except for the rare case.
-      protected boolean handleAliasAction(SolrQueryRequest req, SolrQueryResponse rsp) ; 
+      protected boolean handleAliasAction(SolrQueryRequest req, SolrQueryResponse rsp) ;
-      protected boolean handleCreateAction(SolrQueryRequest req, SolrQueryResponse rsp) ; 
+      protected boolean handleCreateAction(SolrQueryRequest req, SolrQueryResponse rsp) ;
-      // etc. 
+      // etc.
  }
  }}}
  
-   See [[https://issues.apache.org/jira/browse/SOLR-1106|SOLR-1106]] for more details. 
+   See [[https://issues.apache.org/jira/browse/SOLR-1106|SOLR-1106]] for more details.
  
  The `<core>` tag accepts the following attributes:
    *'''name''' - The registered core name.  This will be how the core is accessed.
@@ -121, +121 @@

  == property ==
  The `<property>` tag accepts two attributes:
    *'''name''' - The name of the property
-   *'''value''' - The value of the property 
+   *'''value''' - The value of the property
  
  == solr.xml Permissions ==
  It is important to note that persistent=true functionality ''''replaces'''' solr.xml it does not edit it.  This means that the directory the file is in needs to allow the web server to replace the file.  If the permissions are set incorrectly it will give 500 errors and throw IOExceptions.  Additionally, all comments are wiped from the file on save.
@@ -135, +135 @@

  
  This will start solr running two cores: ''core0'', and ''core1''.  To access each core, try:
   http://localhost:8983/solr/core0/select?q=*:*
-  
+ 
   http://localhost:8983/solr/core1/select?q=*:*
  
  
  To access the admin pages for each core visit:
   http://localhost:8983/solr/core0/admin/
-  
+ 
   http://localhost:8983/solr/core1/admin/