当前位置: 首页>>代码示例>>Java>>正文


Java CollectionAdminResponse.setResponse方法代码示例

本文整理汇总了Java中org.apache.solr.client.solrj.response.CollectionAdminResponse.setResponse方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionAdminResponse.setResponse方法的具体用法?Java CollectionAdminResponse.setResponse怎么用?Java CollectionAdminResponse.setResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.solr.client.solrj.response.CollectionAdminResponse的用法示例。


在下文中一共展示了CollectionAdminResponse.setResponse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入方法依赖的package包/类
@Override
public CollectionAdminResponse process(SolrServer server) throws SolrServerException, IOException
{
  long startTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
  CollectionAdminResponse res = new CollectionAdminResponse();
  res.setResponse( server.request( this ) );
  long endTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
  res.setElapsedTime(endTime - startTime);
  return res;
}
 
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:CollectionAdminRequest.java

示例2: createCollection

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入方法依赖的package包/类
protected CollectionAdminResponse createCollection(Map<String, List<Integer>> collectionInfos,
                                                   String collectionName, int numShards, int numReplicas, int maxShardsPerNode, SolrServer client, String createNodeSetStr) throws SolrServerException, IOException {
  // TODO: Use CollectionAdminRequest for this test
  ModifiableSolrParams params = new ModifiableSolrParams();
  params.set("action", CollectionAction.CREATE.toString());

  params.set(OverseerCollectionProcessor.NUM_SLICES, numShards);
  params.set(ZkStateReader.REPLICATION_FACTOR, numReplicas);
  params.set(ZkStateReader.MAX_SHARDS_PER_NODE, maxShardsPerNode);
  if (createNodeSetStr != null) params.set(OverseerCollectionProcessor.CREATE_NODE_SET, createNodeSetStr);

  int clientIndex = clients.size() > 1 ? random().nextInt(2) : 0;
  List<Integer> list = new ArrayList<>();
  list.add(numShards);
  list.add(numReplicas);
  if (collectionInfos != null) {
    collectionInfos.put(collectionName, list);
  }
  params.set("name", collectionName);
  SolrRequest request = new QueryRequest(params);
  request.setPath("/admin/collections");

  CollectionAdminResponse res = new CollectionAdminResponse();
  if (client == null) {
    final String baseUrl = ((HttpSolrServer) clients.get(clientIndex)).getBaseURL().substring(
        0,
        ((HttpSolrServer) clients.get(clientIndex)).getBaseURL().length()
            - DEFAULT_COLLECTION.length() - 1);
    
    SolrServer aClient = createNewSolrServer("", baseUrl);
    res.setResponse(aClient.request(request));
    aClient.shutdown();
  } else {
    res.setResponse(client.request(request));
  }
  return res;
}
 
开发者ID:europeana,项目名称:search,代码行数:38,代码来源:BasicDistributedZkTest.java

示例3: createCollection

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入方法依赖的package包/类
protected CollectionAdminResponse createCollection(Map<String, List<Integer>> collectionInfos, String collectionName, Map<String, Object> collectionProps, SolrServer client, String confSetName)  throws SolrServerException, IOException{
  ModifiableSolrParams params = new ModifiableSolrParams();
  params.set("action", CollectionAction.CREATE.toString());
  for (Map.Entry<String, Object> entry : collectionProps.entrySet()) {
    if(entry.getValue() !=null) params.set(entry.getKey(), String.valueOf(entry.getValue()));
  }
  Integer numShards = (Integer) collectionProps.get(NUM_SLICES);
  if(numShards==null){
    String shardNames = (String) collectionProps.get(SHARDS_PROP);
    numShards = StrUtils.splitSmart(shardNames,',').size();
  }
  Integer replicationFactor = (Integer) collectionProps.get(REPLICATION_FACTOR);
  if(replicationFactor==null){
    replicationFactor = (Integer) OverseerCollectionProcessor.COLL_PROPS.get(REPLICATION_FACTOR);
  }

  if (confSetName != null) {
    params.set("collection.configName", confSetName);
  }

  int clientIndex = random().nextInt(2);
  List<Integer> list = new ArrayList<>();
  list.add(numShards);
  list.add(replicationFactor);
  if (collectionInfos != null) {
    collectionInfos.put(collectionName, list);
  }
  params.set("name", collectionName);
  SolrRequest request = new QueryRequest(params);
  request.setPath("/admin/collections");

  CollectionAdminResponse res = new CollectionAdminResponse();
  if (client == null) {
    final String baseUrl = getBaseUrl((HttpSolrServer) clients.get(clientIndex));
    SolrServer server = createNewSolrServer("", baseUrl);
    try {
      res.setResponse(server.request(request));
    } finally {
      if (server != null) server.shutdown();
    }
  } else {
    res.setResponse(client.request(request));
  }
  return res;
}
 
开发者ID:europeana,项目名称:search,代码行数:46,代码来源:AbstractFullDistribZkTestBase.java


注:本文中的org.apache.solr.client.solrj.response.CollectionAdminResponse.setResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。