本文整理汇总了Java中org.apache.solr.client.solrj.request.CoreAdminRequest.process方法的典型用法代码示例。如果您正苦于以下问题:Java CoreAdminRequest.process方法的具体用法?Java CoreAdminRequest.process怎么用?Java CoreAdminRequest.process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.client.solrj.request.CoreAdminRequest
的用法示例。
在下文中一共展示了CoreAdminRequest.process方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRemoteCores
import org.apache.solr.client.solrj.request.CoreAdminRequest; //导入方法依赖的package包/类
/**
* Get list of cores from the remote Solr server.
*
* @return Map of cores attributes keyed by core name.
* @throws SophieException
* If the list of cores cannot be fetched.
*/
@SuppressWarnings("unchecked")
public static Map<String, NamedList<Object>> getRemoteCores() throws SophieException {
CoreAdminRequest request = new CoreAdminRequest();
request.setAction(CoreAdminAction.STATUS);
try {
CoreAdminResponse response = request.process(Sophie.client);
return response.getCoreStatus().asMap(-1);
} catch (SolrServerException | IOException | SolrException e) {
throw new SophieException("Unable to fetch list of Solr cores", e);
}
}
示例2: testReloadCore
import org.apache.solr.client.solrj.request.CoreAdminRequest; //导入方法依赖的package包/类
@Test
public void testReloadCore() throws Exception {
SolrInputDocument doc = new SolrInputDocument();
doc.addField("uri", "/doc/1");
doc.addField(TITLE_FIELD, TITLE);
doc.addField(TEXT_FIELD, TEXT);
solr.add(doc);
solr.commit(false, true, true);
CoreAdminRequest reload = new CoreAdminRequest();
reload.setAction(CoreAdminAction.RELOAD);
reload.setCoreName("collection1");
reload.process(solr);
}
示例3: getCoreList
import org.apache.solr.client.solrj.request.CoreAdminRequest; //导入方法依赖的package包/类
public List<String> getCoreList() throws IOException, SolrServerException {
SolrClient solrClient = getSolrclient(null);
CoreAdminRequest coreAdminRequest = new CoreAdminRequest();
coreAdminRequest.setAction(CoreAdminParams.CoreAdminAction.STATUS);
CoreAdminResponse cores = coreAdminRequest.process(solrClient);
List<String> coreList = new ArrayList<String>();
for (int i = 0; i < cores.getCoreStatus().size(); i++) {
coreList.add(cores.getCoreStatus().getName(i));
}
return coreList;
}
示例4: checkIndexExists
import org.apache.solr.client.solrj.request.CoreAdminRequest; //导入方法依赖的package包/类
private boolean checkIndexExists(IndexConfiguration indexConfiguration) {
CoreAdminResponse cores = null;
try {
CoreAdminRequest request = new CoreAdminRequest();
request.setAction(CoreAdminAction.STATUS);
cores = request.process(solrServer);
} catch (SolrServerException | IOException e) {
throw new SolrConfigurationException("Unable to check solr indexes status", e);
}
NamedList<Object> indexStatus = cores.getCoreStatus(indexConfiguration.getName());
return indexStatus != null;
}