Revision 7592
Added by Jing Tao about 11 years ago
SolrServerFactory.java | ||
---|---|---|
56 | 56 |
public static final String SOLR_HOME_PROPERTY_NAME = "solr.homeDir"; |
57 | 57 |
|
58 | 58 |
public static Log log = LogFactory.getLog(SolrServerFactory.class); |
59 |
|
|
60 |
private static CoreContainer coreContainer = null; |
|
59 | 61 |
|
60 | 62 |
public static SolrServer createSolrServer() throws Exception { |
61 | 63 |
SolrServer solrServer = null; |
... | ... | |
63 | 65 |
String solrHomeDir = Settings.getConfiguration().getString(SOLR_HOME_PROPERTY_NAME); |
64 | 66 |
log.info("The configured solr home from properties is " + solrHomeDir); |
65 | 67 |
File configFile = new File(solrHomeDir, "solr.xml"); |
66 |
CoreContainer c = new CoreContainer(solrHomeDir, configFile);
|
|
67 |
c.load(solrHomeDir, configFile); |
|
68 |
solrServer = new EmbeddedSolrServer(c, "collection1"); |
|
68 |
coreContainer = new CoreContainer(solrHomeDir, configFile);
|
|
69 |
coreContainer.load(solrHomeDir, configFile);
|
|
70 |
solrServer = new EmbeddedSolrServer(coreContainer, "collection1");
|
|
69 | 71 |
|
70 | 72 |
return solrServer; |
71 | 73 |
} |
74 |
|
|
75 |
public static CoreContainer getCoreContainer() { |
|
76 |
return coreContainer; |
|
77 |
} |
|
72 | 78 |
} |
Also available in: Unified diff
Print out the solr query result in the xml format.