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

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


        // Start a Solr instance.
        solrRunner = new JettySolrRunner("/solr", PORT);
        solrRunner.start();

        solrServer = new HttpSolrServer("http://localhost:" + PORT + "/solr");
    }
View Full Code Here


        // Start a Solr instance.
        solrRunner = new JettySolrRunner("/solr", SolrComponentTestSupport.PORT);
        solrRunner.start();

        solrServer = new HttpSolrServer("http://localhost:" + SolrComponentTestSupport.PORT + "/solr");
    }
View Full Code Here

        // do we have servers?
        SolrComponent.SolrServerReference ref = getComponent().getSolrServers(this);
        if (ref == null) {

            // no then create new servers
            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 = new SolrComponent.SolrServerReference(this);
            ref.setSolrServer(solrServer);
            ref.setUpdateSolrServer(solrStreamingServer);
View Full Code Here

    collector = new Collector();
   
    if (EXTERNAL_SOLR_SERVER_URL != null) {
      //solrServer = new ConcurrentUpdateSolrServer(EXTERNAL_SOLR_SERVER_URL, 2, 2);
      //solrServer = new SafeConcurrentUpdateSolrServer(EXTERNAL_SOLR_SERVER_URL, 2, 2);
      solrServer = new HttpSolrServer(EXTERNAL_SOLR_SERVER_URL);
      ((HttpSolrServer)solrServer).setParser(new XMLResponseParser());
    } else {
      if (TEST_WITH_EMBEDDED_SOLR_SERVER) {
        solrServer = new TestEmbeddedSolrServer(h.getCoreContainer(), "");
      } else {
View Full Code Here

    collector = new Collector();
   
    if (EXTERNAL_SOLR_SERVER_URL != null) {
      //solrServer = new ConcurrentUpdateSolrServer(EXTERNAL_SOLR_SERVER_URL, 2, 2);
      //solrServer = new SafeConcurrentUpdateSolrServer(EXTERNAL_SOLR_SERVER_URL, 2, 2);
      solrServer = new HttpSolrServer(EXTERNAL_SOLR_SERVER_URL);
      ((HttpSolrServer)solrServer).setParser(new XMLResponseParser());
    } else {
      if (TEST_WITH_EMBEDDED_SOLR_SERVER) {
        solrServer = new TestEmbeddedSolrServer(h.getCoreContainer(), "");
      } else {
View Full Code Here

public class MavenArtifactNotifierCoreSolrConfig {
 
  @Bean
  public HttpSolrServer solrServer(@Value("${solr.url}") String solrUrl,
      @Value("${solr.pool.maxTotalConnections}") Integer maxTotalConnections) throws MalformedURLException {
    HttpSolrServer solrServer = new HttpSolrServer(solrUrl);
   
    solrServer.setMaxTotalConnections(maxTotalConnections);
    solrServer.setDefaultMaxConnectionsPerHost(maxTotalConnections);
    solrServer.setParser(new XMLResponseParser());
   
    return solrServer;
  }
View Full Code Here

    return getSolrServer();
  }

  protected void appendCoreToBaseUrl(String core, SolrServer solrServer) {
    if (StringUtils.isNotEmpty(core) && isHttpSolrServer(solrServer)) {
      HttpSolrServer httpSolrServer = (HttpSolrServer) solrServer;

      String url = SolrServerUtils.appendCoreToBaseUrl(httpSolrServer.getBaseURL(), core);
      httpSolrServer.setBaseURL(url);
    }
  }
View Full Code Here

    }
  }

  private void appendAuthentication(Credentials credentials, String authPolicy, SolrServer solrServer) {
    if (isHttpSolrServer(solrServer)) {
      HttpSolrServer httpSolrServer = (HttpSolrServer) solrServer;

      if (credentials != null && StringUtils.isNotBlank(authPolicy)
          && assertHttpClientInstance(httpSolrServer.getHttpClient())) {
        AbstractHttpClient httpClient = (AbstractHttpClient) httpSolrServer.getHttpClient();
        httpClient.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY), credentials);
        httpClient.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF, Arrays.asList(authPolicy));
      }
    }
  }
View Full Code Here

      createHttpSolrServer();
    }
  }

  private void createHttpSolrServer() {
    HttpSolrServer httpSolrServer = new HttpSolrServer(this.url);
    if (timeout != null) {
      httpSolrServer.setConnectionTimeout(timeout.intValue());
    }
    if (maxConnections != null) {
      httpSolrServer.setMaxTotalConnections(maxConnections);
    }
    this.setSolrServer(httpSolrServer);
  }
View Full Code Here

        final String baseURL = args[0];
        final String index = args[1];
        final String field = args[2];
        final String term = args[3];

        final SolrServer solr = new HttpSolrServer(baseURL + "/" + index);
        final ModifiableSolrParams params = new ModifiableSolrParams();
        params.set("qt", "/");
        params.set("q", field + ":" + term);
        final SolrRequest req = new QueryRequest(params);

        final QueryResponse resp = solr.query(params);
        System.out.println("resp: " + resp);
    }
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.