Examples of CloudSolrServer


Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

   
    this.maxDocumentLength = maxDocumentLength;
   
    try
    {
      CloudSolrServer cloudSolrServer = new CloudSolrServer(zookeeperHosts);
      cloudSolrServer.setZkClientTimeout(zkClientTimeout);
      cloudSolrServer.setZkConnectTimeout(zkConnectTimeout);
      cloudSolrServer.setDefaultCollection(collection);
      // Set the solrj instance we want to use
      solrServer = cloudSolrServer;
    }
    catch (MalformedURLException e)
    {
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

   
    this.maxDocumentLength = maxDocumentLength;
   
    try
    {
      CloudSolrServer cloudSolrServer = new CloudSolrServer(zookeeperHosts, new ModifiedLBHttpSolrServer(HttpClientUtil.createClient(null)));
      cloudSolrServer.setZkClientTimeout(zkClientTimeout);
      cloudSolrServer.setZkConnectTimeout(zkConnectTimeout);
      cloudSolrServer.setDefaultCollection(collection);
      // Set the solrj instance we want to use
      solrServer = cloudSolrServer;
    }
    catch (MalformedURLException e)
    {
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

        String solrCollection = "solr_" + System.nanoTime();
        req.setParam("name", solrCollection);
        req.setParam("numShards", "2");
        req.setParam("replicationFactor", "2");
        req.setParam("collection.configName", "myconf");
        CloudSolrServer cloudSolrServer = new CloudSolrServer(host);
        NamedList<Object> request = cloudSolrServer.request(req);
//        cloudSolrServer.shutdown();
        return request != null && request.get("success") != null;
    }
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

    }

    private SolrServer initializeWithCloudSolrServer() throws IOException, SolrServerException {
        // try SolrCloud client
        CloudSolrServer cloudSolrServer = new CloudSolrServer(solrZkHost);
        cloudSolrServer.connect();
        cloudSolrServer.setDefaultCollection("collection1"); // workaround for first request when the needed collection may not exist

        // create specified collection if it doesn't exists
        createCollectionIfNeeded(cloudSolrServer);

        cloudSolrServer.setDefaultCollection(solrCollection);

        // SolrCloud may need some time to sync on collection creation (to spread it over the shards / replicas)
        int i = 0;
        while (i < 3) {
            try {
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

        String solrCollection = "solr_" + System.nanoTime();
        req.setParam("name", solrCollection);
        req.setParam("numShards", "2");
        req.setParam("replicationFactor", "2");
        req.setParam("collection.configName", "myconf");
        CloudSolrServer cloudSolrServer = new CloudSolrServer(host);
        NamedList<Object> request = cloudSolrServer.request(req);
        return request != null && request.get("success") != null;
    }
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

    }

    private SolrServer initializeWithCloudSolrServer() throws IOException, SolrServerException {
        // try SolrCloud client
        CloudSolrServer cloudSolrServer = new CloudSolrServer(solrZkHost);
        cloudSolrServer.connect();
        cloudSolrServer.setDefaultCollection("collection1"); // workaround for first request when the needed collection may not exist

        // create specified collection if it doesn't exists
        try {
            createCollectionIfNeeded(cloudSolrServer);
        } catch (Throwable t) {
            if (log.isWarnEnabled()) {
                log.warn("could not create the collection on {}, {}", solrZkHost, t);
            }
        }

        cloudSolrServer.setDefaultCollection(solrCollection);

        // SolrCloud may need some time to sync on collection creation (to spread it over the shards / replicas)
        int i = 0;
        while (i < 3) {
            try {
                SolrPingResponse ping = cloudSolrServer.ping();
                if (ping != null && 0 == ping.getStatus()) {
                    return cloudSolrServer;
                } else {
                    throw new IOException("the found HTTP Solr server is not alive");
                }
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

   
    this.maxDocumentLength = maxDocumentLength;
   
    try
    {
      CloudSolrServer cloudSolrServer = new CloudSolrServer(zookeeperHosts, new ModifiedLBHttpSolrServer(HttpClientUtil.createClient(null)));
      cloudSolrServer.setZkClientTimeout(zkClientTimeout);
      cloudSolrServer.setZkConnectTimeout(zkConnectTimeout);
      cloudSolrServer.setDefaultCollection(collection);
      // Set the solrj instance we want to use
      solrServer = cloudSolrServer;
    }
    catch (MalformedURLException e)
    {
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

    }

    private SolrServer initializeWithCloudSolrServer() throws IOException, SolrServerException {
        // try SolrCloud client
        CloudSolrServer cloudSolrServer = new CloudSolrServer(solrZkHost);
        cloudSolrServer.setDefaultCollection(DEFAULT_COLLECTION);
        if (OakSolrUtils.checkServerAlive(cloudSolrServer)) {
            // TODO : check if oak collection exists, otherwise create it
            return cloudSolrServer;
        } else {
            throw new IOException("the found SolrCloud server is not alive");
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

                                  SolrInputDocument solrInputDoc) throws Exception {
    String originalUser = getAuthenticatedUser();
    try {
      SolrDocumentList orginalSolrDocs = getSolrDocs(collectionName, ALL_DOCS, true);
      setAuthenticationUser(solrUserName);
      CloudSolrServer cloudSolrServer = getCloudSolrServer(collectionName);
      try {
        cloudSolrServer.add(solrInputDoc);
        cloudSolrServer.commit();
      } finally {
        cloudSolrServer.shutdown();
      }

      orginalSolrDocs.add(ClientUtils.toSolrDocument(solrInputDoc));
      SolrDocumentList solrRespDocs = getSolrDocs(collectionName, ALL_DOCS, true);
      // Validate Solr content to check whether the update command went through.
View Full Code Here

Examples of org.apache.solr.client.solrj.impl.CloudSolrServer

                                  SolrInputDocument solrInputDoc) throws Exception {
    String originalUser = getAuthenticatedUser();
    try {
      SolrDocumentList orginalSolrDocs = getSolrDocs(collectionName, ALL_DOCS, true);
      setAuthenticationUser(solrUserName);
      CloudSolrServer cloudSolrServer = getCloudSolrServer(collectionName);
      try {
        cloudSolrServer.add(solrInputDoc);
        cloudSolrServer.commit();
        fail("The specified user: " + solrUserName + " shouldn't get update access!");
      } catch (Exception exception) {
        assertTrue("Expected " + SENTRY_ERROR_MSG + " in " + exception.toString(),
            exception.toString().contains(SENTRY_ERROR_MSG));
      } finally {
        cloudSolrServer.shutdown();
      }

      SolrDocumentList solrRespDocs = getSolrDocs(collectionName, ALL_DOCS, true);
      // Validate Solr content to check whether the update command didn't go through.
      validateSolrDocCountAndContent(orginalSolrDocs, solrRespDocs);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.