Package org.apache.solr.client.solrj.impl

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


        SolrYardConfig config = (SolrYardConfig) this.getConfig();
        String indexLocation = config.getSolrServerLocation();
        if(indexLocation.startsWith("http") && indexLocation.indexOf("://") > 0){
            //init remote server
            try {
                _server = new HttpSolrServer(indexLocation);
                _server.ping(); //test if remove service is available
            } catch (RuntimeException e) {
                throw new YardException("Unable to connect to remote SolrServer '"+
                    config.getSolrServerLocation() +"' because of "+e.getMessage(),e);
            } catch (SolrServerException e) {
View Full Code Here


        if (ref == null) {
            // no then create new servers
            ref = new SolrComponent.SolrServerReference();
            CloudSolrServer cloudServer = getCloudServer();
            if (cloudServer == null) {
                HttpSolrServer solrServer = new HttpSolrServer(url);
                ConcurrentUpdateSolrServer solrStreamingServer = new ConcurrentUpdateSolrServer(url, streamingQueueSize, streamingThreadCount);

                // set the properties on the solr server
                if (maxRetries != null) {
                    solrServer.setMaxRetries(maxRetries);
                }
                if (soTimeout != null) {
                    solrServer.setSoTimeout(soTimeout);
                }
                if (connectionTimeout != null) {
                    solrServer.setConnectionTimeout(connectionTimeout);
                }
                if (defaultMaxConnectionsPerHost != null) {
                    solrServer.setDefaultMaxConnectionsPerHost(defaultMaxConnectionsPerHost);
                }
                if (maxTotalConnections != null) {
                    solrServer.setMaxTotalConnections(maxTotalConnections);
                }
                if (followRedirects != null) {
                    solrServer.setFollowRedirects(followRedirects);
                }
                if (allowCompression != null) {
                    solrServer.setAllowCompression(allowCompression);
                }
                ref.setSolrServer(solrServer);
                ref.setUpdateSolrServer(solrStreamingServer);
            }
            ref.setCloudSolrServer(cloudServer);
View Full Code Here

    static void createSolrFixtures() throws Exception {
        solrHttpsRunner = JettySolrFactory.createJettyTestFixture(true);
        httpsPort = solrHttpsRunner.getLocalPort();
        log.info("Started Https Test Server: " + solrHttpsRunner.getBaseUrl());
        solrHttpsServer = new HttpSolrServer("https://localhost:" + httpsPort + "/solr");
        solrHttpsServer.setConnectionTimeout(60000);

        solrRunner = JettySolrFactory.createJettyTestFixture(false);
        port = solrRunner.getLocalPort();

        solrServer = new HttpSolrServer("http://localhost:" + port + "/solr");

        log.info("Started Test Server: " + solrRunner.getBaseUrl());
        cloudFixture = new SolrCloudFixture("src/test/resources/solr");
    }
View Full Code Here

//        // throw new
//        // SpatialIndexException("Embedded Solr server not supported (change code and dependencies to enable)")
//        // ;
//      }
    } else if (uri.startsWith("http://")) {
      server = new HttpSolrServer(uri);
    } else
      throw new SpatialIndexException(
          "URI for the server must begin 'http://'");

    Resource r = GraphUtils.getResourceValue(root, pDefinition);
View Full Code Here

//            try { coreContainer = initializer.initialize() ; }
//            catch (Exception e) { throw new TextIndexException("Filed to initialize embedded solr", e) ; }
//            server = new EmbeddedSolrServer(coreContainer, coreName);
        }
        else if ( uri.startsWith("http://") )
            server = new HttpSolrServer( uri );
        else
            throw new TextIndexException("URI for the server must begin 'http://'") ;
       
        Resource r = GraphUtils.getResourceValue(root, pEntityMap) ;
        EntityDefinition docDef = (EntityDefinition)a.open(r) ;
View Full Code Here

//            CoreContainer.Initializer initializer = new CoreContainer.Initializer();
//            CoreContainer coreContainer = initializer.initialize();
//            server = new EmbeddedSolrServer(coreContainer, coreName);
        }
        else if ( uri.startsWith("http://") )
            server = new HttpSolrServer( uri );
        else
            throw new TextIndexException("URI for the server must begin 'http://'") ;
       
        Resource r = GraphUtils.getResourceValue(root, pEntityMap) ;
        EntityDefinition docDef = (EntityDefinition)a.open(r) ;
View Full Code Here

    }

    public static List<SolrServer> createHttpSolrServers(Map<String, String> connectionParams, HttpClient httpClient) {
        List<SolrServer> result = Lists.newArrayList();
        for (String shard : SolrConnectionParamUtil.getShards(connectionParams)) {
            result.add(new HttpSolrServer(shard, httpClient));
        }
        if (result.size() == 0) {
            throw new RuntimeException(
                    String.format("You need to specify at least one solr shard connection parameter (%s0={url})",
                            SolrConnectionParams.SOLR_SHARD_PREFIX));
View Full Code Here

            ThreadSafeClientConnManager connectionManager = new ThreadSafeClientConnManager();
            connectionManager.setDefaultMaxPerRoute(5);
            connectionManager.setMaxTotal(50);
            HttpClient httpClient = new DefaultHttpClient(connectionManager);

            solrServer = new HttpSolrServer(solrUrl, httpClient);
        }
    }
View Full Code Here

            SolrServer solrServer = null;
            if (enableSolrCloud) {
                solrServer = new CloudSolrServer("localhost:2181/solr");
                ((CloudSolrServer)solrServer).setDefaultCollection(core.getName());
            } else {
                solrServer = new HttpSolrServer(getUri(core.getName()), httpClient);
            }
            solrServers.put(core.getName(), solrServer);
        }
    }
View Full Code Here

    solrConfig = DataStoreFactory.findProperty(properties, this,
        SOLR_CONFIG_PROPERTY, null);
    solrSchema = DataStoreFactory.findProperty(properties, this,
        SOLR_SCHEMA_PROPERTY, null);
    LOG.info("Using Solr server at " + solrServerUrl);
    adminServer = new HttpSolrServer(solrServerUrl);
    server = new HttpSolrServer(solrServerUrl + "/" + mapping.getCoreName());
    if (autoCreateSchema) {
      createSchema();
    }
    String batchSizeString = DataStoreFactory.findProperty(properties, this,
        SOLR_BATCH_SIZE_PROPERTY, null);
View Full Code Here

TOP

Related Classes of org.apache.solr.client.solrj.impl.HttpSolrServer

Copyright © 2018 www.massapicom. 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.