lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r908197 - in /lucene/solr/trunk: CHANGES.txt example/solr/solr.xml src/java/org/apache/solr/core/CoreContainer.java
Date Tue, 09 Feb 2010 20:14:31 GMT
Author: markrmiller
Date: Tue Feb  9 20:14:31 2010
New Revision: 908197

URL: http://svn.apache.org/viewvc?rev=908197&view=rev
Log:
SOLR-1722: Allowing changing the "special" default core name, and as a default default core
name, switch to using collection1 rather than DEFAULT_CORE

Modified:
    lucene/solr/trunk/CHANGES.txt
    lucene/solr/trunk/example/solr/solr.xml
    lucene/solr/trunk/src/java/org/apache/solr/core/CoreContainer.java

Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=908197&r1=908196&r2=908197&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Tue Feb  9 20:14:31 2010
@@ -70,7 +70,7 @@
 
 * SOLR-1177: Distributed Search support for TermsComponent (Matt Weber via shalin)
 
-* SOLR-1621: Allow current single core deployments to be specified by solr.xml (Mark Miller
, noble)
+* SOLR-1621, SOLR-1722: Allow current single core deployments to be specified by solr.xml
(Mark Miller , noble)
 
 * SOLR-1532: Allow StreamingUpdateSolrServer to use a provided HttpClient (Gabriele Renzi
via shalin)
 

Modified: lucene/solr/trunk/example/solr/solr.xml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/example/solr/solr.xml?rev=908197&r1=908196&r2=908197&view=diff
==============================================================================
--- lucene/solr/trunk/example/solr/solr.xml (original)
+++ lucene/solr/trunk/example/solr/solr.xml Tue Feb  9 20:14:31 2010
@@ -28,7 +28,7 @@
   adminPath: RequestHandler path to manage cores.  
     If 'null' (or absent), cores will not be manageable via request handler
   -->
-  <cores adminPath="/admin/cores">
-    <core name="DEFAULT_CORE" instanceDir="." />
+  <cores adminPath="/admin/cores" defaultCoreName="collection1">
+    <core name="collection1" instanceDir="." />
   </cores>
 </solr>

Modified: lucene/solr/trunk/src/java/org/apache/solr/core/CoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/CoreContainer.java?rev=908197&r1=908196&r2=908197&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/core/CoreContainer.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/core/CoreContainer.java Tue Feb  9 20:14:31
2010
@@ -50,7 +50,7 @@
  */
 public class CoreContainer 
 {
-  private static final String DEFAULT_CORE_NAME = "DEFAULT_CORE";
+  private static final String DEFAULT_DEFAULT_CORE_NAME = "collection1";
 
   protected static Logger log = LoggerFactory.getLogger(CoreContainer.class);
   
@@ -70,6 +70,8 @@
   protected String solrHome;
   protected String solrConfigFilenameOverride;
 
+  private String defaultCoreName = DEFAULT_DEFAULT_CORE_NAME;
+
   public CoreContainer() {
     solrHome = SolrResourceLoader.locateSolrHome();
   }
@@ -210,7 +212,10 @@
     solrHome = loader.getInstanceDir();
     try {
       Config cfg = new Config(loader, null, cfgis, null);
-
+      String dcoreName = cfg.get("solr/@defaultCoreName", null);
+      if(dcoreName != null) {
+        defaultCoreName = dcoreName;
+      }
       persistent = cfg.getBool( "solr/@persistent", false );
       libDir     = cfg.get(     "solr/@sharedLib", null);
       adminPath  = cfg.get(     "solr/cores/@adminPath", null );
@@ -248,7 +253,7 @@
         Node node = nodes.item(i);
         try {
           String name = DOMUtil.getAttr(node, "name", null);
-          if(name.equals(DEFAULT_CORE_NAME)){
+          if(name.equals(defaultCoreName)){
             if(defaultCoreFound) throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Only
one 'DEFAULT_CORE' is allowed ");            
             defaultCoreFound = true;
             name="";
@@ -488,7 +493,7 @@
   }
 
   private String checkDefault(String name) {
-    return name.length() == 0  || DEFAULT_CORE_NAME.equals(name) || name.trim().length()
== 0 ? "" : name;
+    return name.length() == 0  || defaultCoreName.equals(name) || name.trim().length() ==
0 ? "" : name;
   } 
 
   /**
@@ -769,7 +774,7 @@
   private static final String DEF_SOLR_XML ="<?xml version=\"1.0\" encoding=\"UTF-8\"
?>\n" +
           "<solr persistent=\"false\">\n" +
           "  <cores adminPath=\"/admin/cores\">\n" +
-          "    <core name=\""+ DEFAULT_CORE_NAME + "\" instanceDir=\".\" />\n" +
+          "    <core name=\""+ DEFAULT_DEFAULT_CORE_NAME + "\" instanceDir=\".\" />\n"
+
           "  </cores>\n" +
           "</solr>";
 }



Mime
View raw message