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

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


    run(ToolUtil.toArgMap(
        Nutch.ARG_SOLR, solrUrl,
        Nutch.ARG_BATCH, batchId));
    // do the commits once and for all the reducers in one go
    SolrServer solr = new CommonsHttpSolrServer(solrUrl);
    if (getConf().getBoolean(SolrConstants.COMMIT_INDEX, true)) {
      solr.commit();
    }
    LOG.info("SolrIndexerJob: done.");
  }
View Full Code Here


  @Override
  public void open(TaskAttemptContext job)
  throws IOException {
    Configuration conf = job.getConfiguration();
    solr = new CommonsHttpSolrServer(conf.get(SolrConstants.SERVER_URL));
    commitSize = conf.getInt(SolrConstants.COMMIT_SIZE, 1000);
    solrMapping = SolrMappingReader.getInstance(conf);
  }
View Full Code Here

  @Override
  public void setup(Context job) throws IOException {
    Configuration conf = job.getConfiguration();
    try {
      solr = new CommonsHttpSolrServer(conf.get(SolrConstants.SERVER_URL));
    } catch (MalformedURLException e) {
      throw new IOException(e);
    }
  }
View Full Code Here

    @Override
    public List<InputSplit> getSplits(JobContext context)
    throws IOException, InterruptedException {
      Configuration conf = context.getConfiguration();
      int numSplits = context.getNumReduceTasks();
      SolrServer solr = new CommonsHttpSolrServer(conf.get(SolrConstants.SERVER_URL));

      final SolrQuery solrQuery = new SolrQuery(SOLR_GET_ALL_QUERY);
      solrQuery.setFields(SolrConstants.ID_FIELD);
      solrQuery.setRows(1);

      QueryResponse response;
      try {
        response = solr.query(solrQuery);
      } catch (final SolrServerException e) {
        throw new IOException(e);
      }

      int numResults = (int)response.getResults().getNumFound();
View Full Code Here

    @Override
    public RecordReader<Text, SolrRecord> createRecordReader(InputSplit split,
        TaskAttemptContext context) throws IOException, InterruptedException {
      Configuration conf = context.getConfiguration();
      SolrServer solr = new CommonsHttpSolrServer(conf.get(SolrConstants.SERVER_URL));
      SolrInputSplit solrSplit = (SolrInputSplit) split;
      final int numDocs = (int) solrSplit.getLength();
     
      SolrQuery solrQuery = new SolrQuery(SOLR_GET_ALL_QUERY);
      solrQuery.setFields(SolrConstants.ID_FIELD, SolrConstants.BOOST_FIELD,
                          SolrConstants.TIMESTAMP_FIELD,
                          SolrConstants.DIGEST_FIELD);
      solrQuery.setStart(solrSplit.getDocBegin());
      solrQuery.setRows(numDocs);

      QueryResponse response;
      try {
        response = solr.query(solrQuery);
      } catch (final SolrServerException e) {
        throw new IOException(e);
      }

      final SolrDocumentList solrDocs = response.getResults();
View Full Code Here

    private String name = null;

    private StringBuilder text = new StringBuilder();

    public SolrConsumer(String url) throws MalformedURLException {
        this.solr = new CommonsHttpSolrServer(url);
    }
View Full Code Here

      String solrPathParam = String.valueOf(getContext().
              getConfigParameterValue("solrPath"));
 
      if (solrInstanceTypeParam.equalsIgnoreCase("http")) {
        URL solrURL = UriUtils.create(solrPathParam).toURL();
        solrServer = new CommonsHttpSolrServer(solrURL);
      }
    } catch (Exception e) {
      throw new SolrServerException("Error creating SolrServer", e);
    }
View Full Code Here

  @Override
  protected CommonsHttpSolrServer createNewSolrServer() {
    try {
      // setup the server...
      String url = "http://localhost:" + port + context;
      CommonsHttpSolrServer s = new CommonsHttpSolrServer(url);
      s.setConnectionTimeout(100); // 1/10th sec
      s.setDefaultMaxConnectionsPerHost(100);
      s.setMaxTotalConnections(100);
      return s;
    } catch (Exception ex) {
      throw new RuntimeException(ex);
    }
  }
View Full Code Here

  protected SolrServer createNewSolrServer(int port)
  {
    try {
      // setup the server...
      String url = "http://localhost:"+port+context;
      CommonsHttpSolrServer s = new CommonsHttpSolrServer( url );
      s.setConnectionTimeout(100); // 1/10th sec
      s.setDefaultMaxConnectionsPerHost(100);
      s.setMaxTotalConnections(100);
      return s;
    }
    catch( Exception ex ) {
      throw new RuntimeException( ex );
    }
View Full Code Here

    }

    LOG.info("Using Solr: " + this.solrUrl + " FileManager: " + this.fmUrl);

    try {
      server = new CommonsHttpSolrServer(this.solrUrl);
    } catch (MalformedURLException e) {
      LOG.severe("Could not connect to Solr server " + this.solrUrl);
      throw new InstantiationException(e.getMessage());
    }
View Full Code Here

TOP

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

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.