Revision 7593
Added by Jing Tao almost 11 years ago
SolrServerFactory.java | ||
---|---|---|
54 | 54 |
public class SolrServerFactory { |
55 | 55 |
|
56 | 56 |
public static final String SOLR_HOME_PROPERTY_NAME = "solr.homeDir"; |
57 |
public static final String SOLR_CONFIG_FILE_NAME_PROPERTY_NAME = "solr.configFileName"; |
|
58 |
public static final String SOLR_COLLECTION_NAME_PROPERTY_NAME = "solr.collectionName"; |
|
59 |
public static final String SOLR_SERVER_CLASSNAME_PROPERTY_NAME = "solr.server.classname"; |
|
60 |
private static final String EMBEDDEDSERVERCLASS = "org.apache.solr.client.solrj.embedded.EmbeddedSolrServer"; |
|
61 |
private static final String HTTPSERVERCLASS = "org.apache.solr.client.solrj.impl.CommonsHttpSolrServer"; |
|
57 | 62 |
|
58 | 63 |
public static Log log = LogFactory.getLog(SolrServerFactory.class); |
59 | 64 |
|
... | ... | |
64 | 69 |
|
65 | 70 |
String solrHomeDir = Settings.getConfiguration().getString(SOLR_HOME_PROPERTY_NAME); |
66 | 71 |
log.info("The configured solr home from properties is " + solrHomeDir); |
67 |
File configFile = new File(solrHomeDir, "solr.xml"); |
|
72 |
String configFileName = Settings.getConfiguration().getString(SOLR_CONFIG_FILE_NAME_PROPERTY_NAME); |
|
73 |
File configFile = new File(solrHomeDir, configFileName); |
|
68 | 74 |
coreContainer = new CoreContainer(solrHomeDir, configFile); |
69 | 75 |
coreContainer.load(solrHomeDir, configFile); |
70 |
solrServer = new EmbeddedSolrServer(coreContainer, "collection1"); |
|
76 |
String collectioname = Settings.getConfiguration().getString(SOLR_COLLECTION_NAME_PROPERTY_NAME); |
|
77 |
solrServer = new EmbeddedSolrServer(coreContainer, collectioname); |
|
71 | 78 |
|
72 | 79 |
return solrServer; |
73 | 80 |
} |
Also available in: Unified diff
Read the solr configuration file name and collection name from the property file.