本文整理汇总了Java中org.apache.solr.client.solrj.response.CollectionAdminResponse类的典型用法代码示例。如果您正苦于以下问题:Java CollectionAdminResponse类的具体用法?Java CollectionAdminResponse怎么用?Java CollectionAdminResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CollectionAdminResponse类属于org.apache.solr.client.solrj.response包,在下文中一共展示了CollectionAdminResponse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: splitShard
import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
public static CollectionAdminResponse splitShard( String name, String shard, String ranges, SolrServer server,
String asyncId) throws SolrServerException, IOException
{
SplitShard req = new SplitShard();
req.setCollectionName(name);
req.setShardName(shard);
req.setRanges(ranges);
req.setAsyncId(asyncId);
return req.process( server );
}
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:CollectionAdminRequest.java
示例17: deleteShard
import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
public static CollectionAdminResponse deleteShard( String name, String shard, SolrServer server ) throws SolrServerException, IOException
{
CollectionShardAdminRequest req = new DeleteShard();
req.setCollectionName(name);
req.setShardName(shard);
return req.process( server );
}
开发者ID:europeana,项目名称:search,代码行数:8,代码来源:CollectionAdminRequest.java
示例18: createAlias
import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
public static CollectionAdminResponse createAlias( String name, String collections, SolrServer server ) throws SolrServerException, IOException
{
CreateAlias req = new CreateAlias();
req.setCollectionName(name);
req.setAliasedCollections(collections);
return req.process( server );
}
开发者ID:europeana,项目名称:search,代码行数:8,代码来源:CollectionAdminRequest.java
示例19: createCollection
import org.apache.solr.client.solrj.response.CollectionAdminResponse; //导入依赖的package包/类
protected CollectionAdminResponse createCollection(Map<String,List<Integer>> collectionInfos,
String collectionName, int numShards, int replicationFactor, int maxShardsPerNode, SolrServer client, String createNodeSetStr) throws SolrServerException, IOException {
return createCollection(collectionInfos, collectionName,
ZkNodeProps.makeMap(
NUM_SLICES, numShards,
REPLICATION_FACTOR, replicationFactor,
CREATE_NODE_SET, createNodeSetStr,
MAX_SHARDS_PER_NODE, maxShardsPerNode),
client);
}
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:AbstractFullDistribZkTestBase.java
示例20: 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
注:本文中的org.apache.solr.client.solrj.response.CollectionAdminResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论