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

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


  public SolrServer getSolrServer(String url)
    throws SSAFSolrException
  {
    if (server == null) {
      try {
        this.server = new CommonsHttpSolrServer( url );
      }
      catch (MalformedURLException e)
      {
        SSAFSolrException ssafException =
                    new SSAFSolrException(
View Full Code Here


  public SolrServer getSolrServer(String url)
    throws SSAFSolrException
  {
    if (server == null) {
      try {
        this.server = new CommonsHttpSolrServer( url );
      }
      catch (MalformedURLException e)
      {
        SSAFSolrException ssafException =  new SSAFSolrException();
        ssafException.setFatalError(SSAFSolrErrorCodes.ERROR_CONNECTING_SERVER);
View Full Code Here

    FileOutputFormat.setOutputPath(job, tmp);
    try {
      JobClient.runJob(job);
      // do the commits once and for all the reducers in one go
      SolrServer solr =  new CommonsHttpSolrServer(solrUrl);
      solr.commit();
    }
    catch (Exception e){
      LOG.error(e);
    } finally {
      FileSystem.get(job).delete(tmp, true);
View Full Code Here

  }

  @Override
  public void configure(JobConf job) {
    try {
      solr = new CommonsHttpSolrServer(job.get(SolrConstants.SERVER_URL));
    } catch (MalformedURLException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

  public static class SolrInputFormat implements InputFormat<Text, SolrRecord> {

    /** Return each index as a split. */
    public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException {
      SolrServer solr = new CommonsHttpSolrServer(job.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

    public RecordReader<Text, SolrRecord> getRecordReader(final InputSplit split,
        final JobConf job,
        Reporter reporter)
        throws IOException {

      SolrServer solr = new CommonsHttpSolrServer(job.get(SolrConstants.SERVER_URL));
      SolrInputSplit solrSplit = (SolrInputSplit) split;
      final int numDocs = solrSplit.getNumDocs();
     
      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

    new ArrayList<SolrInputDocument>();

  private int commitSize;

  public void open(JobConf job, String name) throws IOException {
    solr = new CommonsHttpSolrServer(job.get(SolrConstants.SERVER_URL));
    commitSize = job.getInt(SolrConstants.COMMIT_SIZE, 1000);
    solrMapping = SolrMappingReader.getInstance(job);
  }
View Full Code Here

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

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

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

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

    private int streamingQueueSize;

    public SolrEndpoint(String endpointUri, SolrComponent component, String address, Map<String, Object> parameters) throws Exception {
        super(endpointUri, component);

        solrServer = new CommonsHttpSolrServer("http://" + address);
        streamingQueueSize = getIntFromString((String) parameters.get(SolrConstants.PARAM_STREAMING_QUEUE_SIZE), SolrConstants.DEFUALT_STREAMING_QUEUE_SIZE);
        streamingThreadCount = getIntFromString((String) parameters.get(SolrConstants.PARAM_STREAMING_THREAD_COUNT), SolrConstants.DEFAULT_STREAMING_THREAD_COUNT);
        streamingSolrServer = new StreamingUpdateSolrServer("http://" + address, streamingQueueSize, streamingThreadCount);
    }
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.