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


Java CollectionAdminResponse类代码示例

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


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

示例1: createCollectionIfNotExists

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
private static void createCollectionIfNotExists(CloudSolrClient client, Configuration config, String collection)
        throws IOException, SolrServerException, KeeperException, InterruptedException {
    if (!checkIfCollectionExists(client, collection)) {
        Integer numShards = config.get(NUM_SHARDS);
        Integer maxShardsPerNode = config.get(MAX_SHARDS_PER_NODE);
        Integer replicationFactor = config.get(REPLICATION_FACTOR);

        CollectionAdminRequest.Create createRequest = new CollectionAdminRequest.Create();

        createRequest.setConfigName(collection);
        createRequest.setCollectionName(collection);
        createRequest.setNumShards(numShards);
        createRequest.setMaxShardsPerNode(maxShardsPerNode);
        createRequest.setReplicationFactor(replicationFactor);

        CollectionAdminResponse createResponse = createRequest.process(client);
        if (createResponse.isSuccess()) {
            logger.trace("Collection {} successfully created.", collection);
        } else {
            throw new SolrServerException(Joiner.on("\n").join(createResponse.getErrorMessages()));
        }
    }

    waitForRecoveriesToFinish(client, collection);
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:26,代码来源:Solr5Index.java

示例2: createCollection

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
public static CollectionAdminResponse createCollection( String name,
                                                        Integer shards, Integer repl, Integer maxShards,
                                                        String nodeSet,
                                                        String conf,
                                                        String routerField,
                                                        Boolean autoAddReplicas,
                                                        SolrServer server) throws SolrServerException, IOException
{
  Create req = new Create();
  req.setCollectionName(name);
  req.setRouterName("compositeId");
  req.setNumShards(shards);
  req.setReplicationFactor(repl);
  req.setMaxShardsPerNode(maxShards);
  req.setCreateNodeSet(nodeSet);
  req.setConfigName(conf);
  req.setRouterField(routerField);
  req.setAutoAddReplicas(autoAddReplicas);
  return req.process( server );
}
 
开发者ID:europeana,项目名称:search,代码行数:21,代码来源:CollectionAdminRequest.java

示例3: testDeduplicationOfSubmittedTasks

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
private void testDeduplicationOfSubmittedTasks() throws IOException, SolrServerException {
  SolrServer server = createNewSolrServer("", getBaseUrl((HttpSolrServer) clients.get(0)));
  CollectionAdminRequest.createCollection("ocptest_shardsplit2", 4, "conf1", server, "3000");

  CollectionAdminRequest.splitShard("ocptest_shardsplit2", SHARD1, server, "3001");
  CollectionAdminRequest.splitShard("ocptest_shardsplit2", SHARD2, server, "3002");

  // Now submit another task with the same id. At this time, hopefully the previous 3002 should still be in the queue.
  CollectionAdminResponse response = CollectionAdminRequest.splitShard("ocptest_shardsplit2", SHARD1, server, "3002");
  NamedList r = response.getResponse();
  assertEquals("Duplicate request was supposed to exist but wasn't found. De-duplication of submitted task failed.",
      "Task with the same requestid already exists.", r.get("error"));

  for (int i=3001;i<=3002;i++) {
    String state = getRequestStateAfterCompletion(i + "", REQUEST_STATUS_TIMEOUT, server);
    assertTrue("Task " + i + " did not complete, final state: " + state,state.equals("completed"));
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:MultiThreadedOCPTest.java

示例4: createCollectionIfNotExists

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
private static void createCollectionIfNotExists(CloudSolrServer server, Configuration config, String collection)
        throws IOException, SolrServerException, KeeperException, InterruptedException {
    if (!checkIfCollectionExists(server, collection)) {
        Integer numShards = config.get(NUM_SHARDS);
        Integer maxShardsPerNode = config.get(MAX_SHARDS_PER_NODE);
        Integer replicationFactor = config.get(REPLICATION_FACTOR);

        CollectionAdminRequest.Create createRequest = new CollectionAdminRequest.Create();

        createRequest.setConfigName(collection);
        createRequest.setCollectionName(collection);
        createRequest.setNumShards(numShards);
        createRequest.setMaxShardsPerNode(maxShardsPerNode);
        createRequest.setReplicationFactor(replicationFactor);

        CollectionAdminResponse createResponse = createRequest.process(server);
        if (createResponse.isSuccess()) {
            logger.trace("Collection {} successfully created.", collection);
        } else {
            throw new SolrServerException(Joiner.on("\n").join(createResponse.getErrorMessages()));
        }
    }

    waitForRecoveriesToFinish(server, collection);
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:26,代码来源:SolrIndex.java

示例5: createCollection

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
/** Creates a collection. */
public CreateCollectionResponse createCollection(String collectionName, int numShards, int numReplicas,
        String configName) {
    if (collectionExists(collectionName)) {
        return null;
    }

    try {
        final CollectionAdminRequest.Create createCollectionRequest =
                CollectionAdminRequest.createCollection(collectionName, configName, numShards, numReplicas);

        final CollectionAdminResponse response = createCollectionRequest.process(solrClient);
        return new CreateCollectionResponse(response);
    } catch (IOException | SolrServerException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:shaie,项目名称:lucenelab,代码行数:18,代码来源:CollectionAdminHelper.java

示例6: deleteCollection

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
/** Deletes a collection. */
public DeleteCollectionResponse deleteCollection(String collectionName) {
    if (!collectionExists(collectionName)) {
        return null;
    }

    try {
        final CollectionAdminRequest.Delete deleteCollectionRequest =
                CollectionAdminRequest.deleteCollection(collectionName);

        final CollectionAdminResponse response = deleteCollectionRequest.process(solrClient);
        return new DeleteCollectionResponse(response);
    } catch (IOException | SolrServerException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:shaie,项目名称:lucenelab,代码行数:17,代码来源:CollectionAdminHelper.java

示例7: addReplica

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
/** Adds a replica to the given collection and shard. */
public AddReplicaResponse addReplica(String collectionName, String shardName, String nodeName) {
    if (!collectionExists(collectionName)) {
        throw new IllegalArgumentException("collection [" + collectionName + "] does not exist");
    }

    try {
        final CollectionAdminRequest.AddReplica addReplicaRequest =
                CollectionAdminRequest.addReplicaToShard(collectionName, shardName)
                        .setNode(nodeName);
        final CollectionAdminResponse response = addReplicaRequest.process(solrClient);
        return new AddReplicaResponse(response);
    } catch (IOException | SolrServerException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:shaie,项目名称:lucenelab,代码行数:17,代码来源:CollectionAdminHelper.java

示例8: cluster_status_parsed_successfully

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
@Test
public void cluster_status_parsed_successfully() throws SolrServerException, IOException {
    final String[] nodeIds = new String[] { "node1", "node2", "node3", "node4" };
    solrCluster.startSolrNodes("node1", "node2", "node3", "node4");

    initCluster();
    createAlias();
    addOverseerRole();

    final CollectionAdminRequest.ClusterStatus clusterStatusRequest = new CollectionAdminRequest.ClusterStatus();
    final CollectionAdminResponse response = clusterStatusRequest.process(solrClient);
    final ClusterStatusResponse clusterStatusResponse = new ClusterStatusResponse(response);

    assertResponseLiveNodes(nodeIds, clusterStatusResponse);
    assertThat(clusterStatusResponse.getAliases()).isEqualTo(ImmutableMap.of("both", "collection1,collection2"));
    assertThat(clusterStatusResponse.getRoles()).isEqualTo(
            ImmutableMap.of("overseer", Lists.newArrayList(
                    SolrCloudUtils.baseUrlToNodeName(solrCluster.getBaseUrl("node1")),
                    SolrCloudUtils.baseUrlToNodeName(solrCluster.getBaseUrl("node2")))));

    final Map<String, Collection> collections = clusterStatusResponse.getCollections();
    assertThat(collections.size()).isEqualTo(2);
    assertResponseCollection1(collections.get("collection1"));
    assertResponseCollection2(collections.get("collection2"));
}
 
开发者ID:shaie,项目名称:lucenelab,代码行数:26,代码来源:ClusterStatusResponseTest.java

示例9: createCollection

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
public static CollectionAdminResponse createCollection( String name,
                                                        Integer shards, Integer repl, Integer maxShards,
                                                        String nodeSet,
                                                        String conf,
                                                        String routerField,
                                                        SolrServer server ) throws SolrServerException, IOException
{
  Create req = new Create();
  req.setCollectionName(name);
  req.setRouterName("compositeId");
  req.setNumShards(shards);
  req.setReplicationFactor(repl);
  req.setMaxShardsPerNode(maxShards);
  req.setCreateNodeSet(nodeSet);
  req.setConfigName(conf);
  req.setRouterField(routerField);
  return req.process( server );
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:19,代码来源:CollectionAdminRequest.java

示例10: createCollectionIfNotExists

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
private static void createCollectionIfNotExists(CloudSolrClient client, Configuration config, String collection)
        throws IOException, SolrServerException, KeeperException, InterruptedException {
    if (!checkIfCollectionExists(client, collection)) {
        Integer numShards = config.get(NUM_SHARDS);
        Integer maxShardsPerNode = config.get(MAX_SHARDS_PER_NODE);
        Integer replicationFactor = config.get(REPLICATION_FACTOR);


        // Ideally this property used so a new configset is not uploaded for every single
        // index (collection) created in solr.
        // if a generic configSet is not set, make the configset name the same as the collection.
        // This was the default behavior before a default configSet could be specified 
        String  genericConfigSet = config.has(SOLR_DEFAULT_CONFIG) ? config.get(SOLR_DEFAULT_CONFIG):collection;

        CollectionAdminRequest.Create createRequest = new CollectionAdminRequest.Create();

        createRequest.setConfigName(genericConfigSet);
        createRequest.setCollectionName(collection);
        createRequest.setNumShards(numShards);
        createRequest.setMaxShardsPerNode(maxShardsPerNode);
        createRequest.setReplicationFactor(replicationFactor);

        CollectionAdminResponse createResponse = createRequest.process(client);
        if (createResponse.isSuccess()) {
            logger.trace("Collection {} successfully created.", collection);
        } else {
            throw new SolrServerException(Joiner.on("\n").join(createResponse.getErrorMessages()));
        }
    }

    waitForRecoveriesToFinish(client, collection);
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:33,代码来源:SolrIndex.java

示例11: 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

示例12: reloadCollection

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
public static CollectionAdminResponse reloadCollection( String name, SolrServer server, String asyncId )
    throws SolrServerException, IOException
{
  CollectionAdminRequest req = new Reload();
  req.setCollectionName(name);
  req.setAsyncId(asyncId);
  return req.process( server );
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:CollectionAdminRequest.java

示例13: deleteCollection

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
public static CollectionAdminResponse deleteCollection( String name, SolrServer server,
                                                        String asyncId)
    throws SolrServerException, IOException
{
  CollectionAdminRequest req = new Delete();
  req.setCollectionName(name);
  req.setAsyncId(asyncId);
  return req.process( server );
}
 
开发者ID:europeana,项目名称:search,代码行数:10,代码来源:CollectionAdminRequest.java

示例14: requestStatus

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
public static CollectionAdminResponse requestStatus(String requestId, SolrServer server)
    throws SolrServerException, IOException {
  RequestStatus req = new RequestStatus();

  req.setRequestId(requestId);
  return req.process(server);
}
 
开发者ID:europeana,项目名称:search,代码行数:8,代码来源:CollectionAdminRequest.java

示例15: createShard

import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
public static CollectionAdminResponse createShard( String name, String shard, String nodeSet, SolrServer server ) throws SolrServerException, IOException
{
  CreateShard req = new CreateShard();
  req.setCollectionName(name);
  req.setShardName(shard);
  req.setNodeSet(nodeSet);
  return req.process( server );
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:CollectionAdminRequest.java


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