Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

move default configuration dir from ./conf to ./solrconf

Yonik Seeley0f9bcba8ad2d
diff --git a/example/conf/protwords.txt b/example/solrconf/protwords.txt
similarity index 100%
rename from example/conf/protwords.txt
rename to example/solrconf/protwords.txt
diff --git a/example/conf/schema.xml b/example/solrconf/schema.xml
similarity index 99%
rename from example/conf/schema.xml
rename to example/solrconf/schema.xml
index 5960d062dc7..2fc2932f7f7 100755
--- a/example/conf/schema.xml
+++ b/example/solrconf/schema.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" ?>
<!-- The Solr schema file. This file should be named "schema.xml" and
- should be in the conf directory or located where the classloader
+ should be in the solrconf directory or located where the classloader
for the Solr webapp can find it.
For more information, on how to customize this file, please see...
diff --git a/example/conf/solrconfig.xml b/example/solrconf/solrconfig.xml
similarity index 100%
rename from example/conf/solrconfig.xml
rename to example/solrconf/solrconfig.xml
diff --git a/example/conf/stopwords.txt b/example/solrconf/stopwords.txt
similarity index 100%
rename from example/conf/stopwords.txt
rename to example/solrconf/stopwords.txt
diff --git a/example/conf/synonyms.txt b/example/solrconf/synonyms.txt
similarity index 100%
rename from example/conf/synonyms.txt
rename to example/solrconf/synonyms.txt
diff --git a/src/apps/SolrTest/conf/protwords.txt b/src/apps/SolrTest/solrconf/protwords.txt
similarity index 100%
rename from src/apps/SolrTest/conf/protwords.txt
rename to src/apps/SolrTest/solrconf/protwords.txt
diff --git a/src/apps/SolrTest/conf/schema.xml b/src/apps/SolrTest/solrconf/schema.xml
similarity index 100%
rename from src/apps/SolrTest/conf/schema.xml
rename to src/apps/SolrTest/solrconf/schema.xml
diff --git a/src/apps/SolrTest/conf/solrconfig.xml b/src/apps/SolrTest/solrconf/solrconfig.xml
similarity index 100%
rename from src/apps/SolrTest/conf/solrconfig.xml
rename to src/apps/SolrTest/solrconf/solrconfig.xml
diff --git a/src/apps/SolrTest/conf/stopwords.txt b/src/apps/SolrTest/solrconf/stopwords.txt
similarity index 100%
rename from src/apps/SolrTest/conf/stopwords.txt
rename to src/apps/SolrTest/solrconf/stopwords.txt
diff --git a/src/apps/SolrTest/conf/synonyms.txt b/src/apps/SolrTest/solrconf/synonyms.txt
similarity index 100%
rename from src/apps/SolrTest/conf/synonyms.txt
rename to src/apps/SolrTest/solrconf/synonyms.txt
diff --git a/src/java/org/apache/solr/core/Config.java b/src/java/org/apache/solr/core/Config.java
index 3e9281e5722..818444b650c 100644
--- a/src/java/org/apache/solr/core/Config.java
+++ b/src/java/org/apache/solr/core/Config.java
@@ -218,6 +218,18 @@ public class Config {
}
}
+ // The directory where solr will look for config files by default.
+ // defaults to "./solrconf/"
+ private static final String configDir;
+ static {
+ String str = System.getProperty("solr.configdir");
+ if (str==null) {
+ str="solrconf/";
+ } else if ( !(str.endsWith("/") || str.endsWith("\\")) ) {
+ str+='/';
+ }
+ configDir = str;
+ }
public static InputStream openResource(String resource) {
InputStream is=null;
@@ -225,8 +237,8 @@ public class Config {
try {
File f = new File(resource);
if (!f.isAbsolute()) {
- // try $CWD/conf/
- f = new File("conf/" + resource);
+ // try $CWD/solrconf/
+ f = new File(configDir + resource);
}
if (f.isFile() && f.canRead()) {
return new FileInputStream(f);
diff --git a/src/java/org/apache/solr/core/SolrConfig.java b/src/java/org/apache/solr/core/SolrConfig.java
index 604d4a239db..3c0b1dcfad9 100644
--- a/src/java/org/apache/solr/core/SolrConfig.java
+++ b/src/java/org/apache/solr/core/SolrConfig.java
@@ -26,28 +26,28 @@ import java.io.InputStream;
public class SolrConfig {
public static Config config;
static {
- Exception e=null;
+ RuntimeException e=null;
String file="solrconfig.xml";
InputStream is=null;
try {
is = Config.openResource(file);
- } catch (Exception ee) {
+ } catch (RuntimeException ee) {
e=ee;
file = "solarconfig.xml"; // backward compat
try {
is = Config.openResource(file);
- } catch (Exception eee) {}
- }
- if (is!=null) {
- try {
- config=new Config(file, is, "/config/");
- is.close();
- } catch (Exception ee) {
- throw new RuntimeException(ee);
+ } catch (Exception eee) {
+ throw e;
}
- Config.log.info("Loaded Config solrconfig.xml");
- } else {
- throw new RuntimeException("Can't find Solr config file ./conf/solrconfig.xml",e);
}
+
+ try {
+ config=new Config(file, is, "/config/");
+ is.close();
+ } catch (Exception ee) {
+ throw new RuntimeException("Error in solrconfig.xml", ee);
+ }
+ Config.log.info("Loaded Config solrconfig.xml");
+
}
}