Revision 7663
Added by Jing Tao over 11 years ago
metacat-common/src/main/java/edu/ucsb/nceas/metacat/common/SolrServerFactory.java | ||
---|---|---|
67 | 67 |
private static CoreContainer coreContainer = null; |
68 | 68 |
private static String collectionName = null; |
69 | 69 |
private static SolrServer solrServer = null; |
70 |
//private static String solrServerBaseURL = null; |
|
70 | 71 |
|
71 | 72 |
public static SolrServer createSolrServer() throws Exception { |
72 | 73 |
if(solrServer == null) { |
... | ... | |
74 | 75 |
if (className != null && className.equals(EMBEDDEDSERVERCLASS)) { |
75 | 76 |
generateEmbeddedServer(); |
76 | 77 |
} else if (className != null && className.equals(HTTPSERVERCLASS)) { |
77 |
String solrServerUrl = Settings.getConfiguration().getString(SOLR_ENPOINT_PROPERTY_NAME);
|
|
78 |
solrServer = new CommonsHttpSolrServer(solrServerUrl);
|
|
78 |
String solrServerBaseURL = Settings.getConfiguration().getString(SOLR_ENPOINT_PROPERTY_NAME);
|
|
79 |
solrServer = new CommonsHttpSolrServer(solrServerBaseURL);
|
|
79 | 80 |
} else { |
80 | 81 |
throw new Exception("SolrServerFactory.createSolrServer - MetacatIndex doesn't support this solr server type: "+className); |
81 | 82 |
} |
... | ... | |
95 | 96 |
} |
96 | 97 |
|
97 | 98 |
/** |
98 |
* Get the the CoreContainer |
|
99 |
* Get the the CoreContainer of the generated EmbeddedSolrServer.
|
|
99 | 100 |
* @return it may return null if the solr is configured as the SolrHttpServer |
100 | 101 |
* @throws Exception |
101 | 102 |
*/ |
... | ... | |
106 | 107 |
return coreContainer; |
107 | 108 |
} |
108 | 109 |
|
110 |
/** |
|
111 |
* Get the CollectionName of the generated EmbeddedSolrServer. It can be null if the solr is configured as a SolrHttpServer |
|
112 |
* @return |
|
113 |
*/ |
|
109 | 114 |
public static String getCollectionName() { |
110 | 115 |
if(collectionName == null) { |
111 | 116 |
collectionName = Settings.getConfiguration().getString(SOLR_COLLECTION_NAME_PROPERTY_NAME); |
112 | 117 |
} |
113 | 118 |
return collectionName; |
114 | 119 |
} |
120 |
|
|
121 |
|
|
115 | 122 |
} |
Also available in: Unified diff
Add some java doc.