Package org.apache.solr.client.solrj

Examples of org.apache.solr.client.solrj.SolrServer.commit()


    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


            logDocuments(documents);

            if (!CollectionUtils.isEmpty(documents)) {
                SolrServer server = useReindexServer ? SolrContext.getReindexServer() : SolrContext.getServer();
                server.add(documents);
                server.commit();
            }
            TransactionUtils.finalizeTransaction(status, transactionManager, false);
        } catch (SolrServerException e) {
            TransactionUtils.finalizeTransaction(status, transactionManager, true);
            throw new ServiceException("Could not rebuild index", e);
View Full Code Here

      JobClient.runJob(job);
      // do the commits once and for all the reducers in one go
      SolrServer solr =  SolrUtils.getCommonsHttpSolrServer(job);

      if (!noCommit) {
        solr.commit();
      }
      long end = System.currentTimeMillis();
      LOG.info("SolrIndexer: finished at " + sdf.format(end) + ", elapsed: " + TimingUtil.elapsedTime(start, end));
    }
    catch (Exception e){
View Full Code Here

      JobClient.runJob(job);
      // do the commits once and for all the reducers in one go
      SolrServer solr =  SolrUtils.getCommonsHttpSolrServer(job);

      if (!noCommit) {
        solr.commit();
      }
      long end = System.currentTimeMillis();
      LOG.info("SolrIndexer: finished at " + sdf.format(end) + ", elapsed: " + TimingUtil.elapsedTime(start, end));
    }
    catch (Exception e){
View Full Code Here

  private void deleteAllDocuments() throws SolrServerException, IOException {
    collector.reset();
    SolrServer s = solrServer;
    s.deleteByQuery("*:*"); // delete everything!
    s.commit();
  }

  protected Command createMorphline(String file) throws IOException {
    return new PipeBuilder().build(parse(file), null, collector, createMorphlineContext());
  }
View Full Code Here

 
  private void deleteAllDocuments() throws SolrServerException, IOException {
    collector.reset();
    SolrServer s = solrServer;
    s.deleteByQuery("*:*"); // delete everything!
    s.commit();
  }

  protected Command createMorphline(String file) throws IOException {
    return new PipeBuilder().build(parse(file), null, collector, createMorphlineContext());
  }
View Full Code Here

            }
        };
        try {
            // safely remove any previous document on the index
            solrServer.deleteByQuery("*:*");
            solrServer.commit();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        OakSolrConfiguration configuration = new DefaultSolrConfiguration() {
            @Override
View Full Code Here

                throw new IllegalArgumentException("exampleId and text should not be null simultaneously");
            }
            SolrServer solrServer = getActiveSolrServer();
            try {
                solrServer.deleteByQuery(exampleIdField + ":" + exampleId);
                solrServer.commit();
                return exampleId;
            } catch (Exception e) {
                String msg = String.format("Error deleting example with id '%s' on Solr Core '%s'",
                    exampleId, solrCoreId);
                throw new TrainingSetException(msg, e);
View Full Code Here

        }
        doc.addField(modificationDateField, UTCTimeStamper.nowUtcDate());
        SolrServer server = getActiveSolrServer();
        try {
            server.add(doc);
            server.commit();
        } catch (Exception e) {
            String msg = String.format("Could not register example '%s' with topics: ['%s']", exampleId,
                StringUtils.join(topics, "', '"));
            throw new TrainingSetException(msg, e);
        }
View Full Code Here

        try {
            UpdateRequest request = new UpdateRequest();
            request.add(metadataEntry);
            request.add(modelEntry);
            solrServer.request(request);
            solrServer.commit();
        } catch (Exception e) {
            String msg = String.format("Error adding topic with id '%s' on Solr Core '%s'", conceptUri,
                solrCoreId);
            throw new ClassifierException(msg, 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.