Examples of CommonsHttpSolrServer


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

  private SolrServer server;
  public static final String DEFAULT_SOLR_URL = "http://localhost:8983/solr";

  public WikipediaIndexer() throws MalformedURLException {
    server = new CommonsHttpSolrServer(DEFAULT_SOLR_URL);
  }
View Full Code Here

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

    }
    int batch = 100;
    if (cmdLine.hasOption(solrBatchOpt)) {
      batch = Integer.parseInt(cmdLine.getValue(solrBatchOpt).toString());
    }
    WikipediaIndexer indexer = new WikipediaIndexer(new CommonsHttpSolrServer(url));
    int total = 0;
    for (int i = 0; i < dumpFiles.length && total < numDocs; i++) {
      File dumpFile = dumpFiles[i];
      log.info("Indexing: " + file + " Num files to index: " + (numDocs - total));
      long start = System.currentTimeMillis();
View Full Code Here

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

  private StringDistance sd;
  private float threshold;
 
  public SpellCorrector(StringDistance sd, float threshold)
    throws MalformedURLException {
    solr = new CommonsHttpSolrServer(
            new URL("http://localhost:8983/solr"));
    query = new SolrQuery();
    query.setFields("word");
    query.setRows(50); //<co id="co.dym.num"/>
    this.sd = sd;
View Full Code Here

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

 
  private SolrServer server;
  public static final String DEFAULT_SOLR_URL = "http://localhost:8983/solr";
 
  public WikipediaWexIndexer() throws MalformedURLException {
    this.server = new CommonsHttpSolrServer(DEFAULT_SOLR_URL);
  }
View Full Code Here

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

      int batch = 100;
      if (cmdLine.hasOption(solrBatchOpt)) {
        batch = Integer.parseInt(cmdLine.getValue(solrBatchOpt).toString());
      }
      WikipediaWexIndexer indexer = new WikipediaWexIndexer(
          new CommonsHttpSolrServer(url));
      int total = 0;
      for (int i = 0; i < dumpFiles.length && total < numDocs; i++) {
        File dumpFile = dumpFiles[i];
        log.info("Indexing: " + file + " Num files to index: "
            + (numDocs - total));
View Full Code Here

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

  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

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

    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

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

    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

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

    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();
      long end = System.currentTimeMillis();
      LOG.info("SolrIndexer: finished at " + sdf.format(end) + ", elapsed: " + TimingUtil.elapsedTime(start, end));
    }
    catch (Exception e){
      LOG.error(e);
View Full Code Here

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

    this.conf = conf;
  }

  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
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.