SOLR-1577: fix data dir default to stay under solr home

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@883202 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2009-11-23 00:36:42 +00:00
parent a2ef4a0d4a
commit ace3e15d0d
4 changed files with 10 additions and 1 deletions

View File

@ -64,6 +64,12 @@ Bug Fixes
* SOLR-1563: Binary fields, including trie-based numeric fields, caused null * SOLR-1563: Binary fields, including trie-based numeric fields, caused null
pointer exceptions in the luke request handler. (yonik) pointer exceptions in the luke request handler. (yonik)
* SOLR-1577: The example solrconfig.xml defaulted to a solr data dir
relative to the current working directory, even if a different solr home
was being used. The new behavior changes the default to a zero length
string, which is treated the same as if no dataDir had been specified,
hence the "data" directory under the solr home will be used. (yonik)
Other Changes Other Changes
---------------------- ----------------------

View File

@ -68,7 +68,7 @@
<!-- Used to specify an alternate directory to hold all index data <!-- Used to specify an alternate directory to hold all index data
other than the default ./data under the Solr home. other than the default ./data under the Solr home.
If replication is in use, this should match the replication configuration. --> If replication is in use, this should match the replication configuration. -->
<dataDir>${solr.data.dir:./solr/data}</dataDir> <dataDir>${solr.data.dir:}</dataDir>
<!-- WARNING: this <indexDefaults> section only provides defaults for index writers <!-- WARNING: this <indexDefaults> section only provides defaults for index writers

View File

@ -109,6 +109,8 @@ public class CoreDescriptor {
public void setDataDir(String s) { public void setDataDir(String s) {
dataDir = s; dataDir = s;
// normalize zero length to null.
if (dataDir != null && dataDir.length()==0) dataDir=null;
} }
/**@return the core instance directory. */ /**@return the core instance directory. */

View File

@ -160,6 +160,7 @@ public class SolrConfig extends Config {
unlockOnStartup = getBool("mainIndex/unlockOnStartup", false); unlockOnStartup = getBool("mainIndex/unlockOnStartup", false);
useColdSearcher = getBool("query/useColdSearcher",false); useColdSearcher = getBool("query/useColdSearcher",false);
dataDir = get("dataDir", null); dataDir = get("dataDir", null);
if (dataDir != null && dataDir.length()==0) dataDir=null;
userCacheConfigs = CacheConfig.getMultipleConfigs(this, "query/cache"); userCacheConfigs = CacheConfig.getMultipleConfigs(this, "query/cache");