lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: finer granularity of configuration
Date Fri, 09 Feb 2007 11:51:33 GMT

On Feb 3, 2007, at 3:43 PM, Erik Hatcher wrote:
> I'd like to be able to have a common schema.xml and solrconfig.xml  
> but be able to fire up Solr instances pointed to different data  
> directories.  I realize we have SOLR-79 in JIRA.  Is that the  
> approach we want long term?
> Here's an off-the-cuff idea... what if we hook Config.get() to look  
> for system properties that would override configuration values.    
> SolrCore does this:
> 	  dataDir = SolrConfig.config.get("dataDir",Config.getInstanceDir() 
> +"data");
> If it looked for a system property (perhaps with a "solr." prefix)  
> you could override anything Config serves up.  Thoughts?

At first I went down the path of modifying Config.get (indirectly, by  
modifying Config.getVal), but it didn't feel quite right because the  
properties it asks for are XPaths.

dataDir is the only one I wanted to override, so I patched this instead:

Index: src/java/org/apache/solr/core/
--- src/java/org/apache/solr/core/ (revision 505245)
+++ src/java/org/apache/solr/core/ (working copy)
@@ -182,7 +182,7 @@
        core = this;   // set singleton
        if (dataDir ==null) {
-        dataDir = SolrConfig.config.get 
+        dataDir = System.getProperty("solr.dataDir",  
        }"Opening new SolrCore at " + Config.getInstanceDir()  
+ ", dataDir="+dataDir);

My use case is this:  I want to have a single solrconfig.xml/ 
schema.xml and Solr distribution, and be able to bring up a Solr  
instance for different data directories.  Nothing more than that.   
For different configurations and schemas, I'd make a copy of the  
configuration directory.

Does this patch make sense to commit as-is, or could it be committed  
with some tweaks, or is it not a good general approach and needs to  
be thought out more?


View raw message