Package org.apache.solr.client.solrj

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


    @Override
    public void removeAllConcepts() throws ClassifierException {
        SolrServer solrServer = getActiveSolrServer();
        try {
            solrServer.deleteByQuery("*:*");
            solrServer.commit();
        } catch (Exception e) {
            String msg = String.format("Error deleting concepts from Solr Core '%s'", solrCoreId);
            throw new ClassifierException(msg, e);
        }
    }
View Full Code Here


            throw new ClassifierException("conceptId must not be null or empty");
        }
        SolrServer solrServer = getActiveSolrServer();
        try {
            solrServer.deleteByQuery(conceptUriField + ":" + ClientUtils.escapeQueryChars(conceptId));
            solrServer.commit();
        } catch (Exception e) {
            String msg = String
                    .format("Error removing concept '%s' on Solr Core '%s'", conceptId, solrCoreId);
            throw new ClassifierException(msg, e);
        }
View Full Code Here

                        count++;
                        batchDocuments.add(result);
                    }
                }
                processedCount += processor.process(batchDocuments);
                solrServer.commit();
                if (count < batchSize) {
                    done = true;
                }
            }
            solrServer.optimize();
View Full Code Here

                }
                i++;
                if (i % 100 == 0) System.out.println(i + " items imported so far...");
            }
            System.out.println("Total: " + i + " items");
            server.commit();
            return i;
        } catch (SQLException ex) {
            throw new DSpaceSolrIndexerException(ex.getMessage(), ex);
        } catch (SolrServerException ex) {
            throw new DSpaceSolrIndexerException(ex.getMessage(), ex);
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

        SolrServer solrServer = TestUtils.createSolrServer();
        SolrInputDocument document = new SolrInputDocument();
        document.addField("path_exact", "/a/b");
        document.addField("name", "hello");
        solrServer.add(document);
        solrServer.commit();
        OakSolrConfiguration configuration = new DefaultSolrConfiguration() {
            @Override
            public boolean useForPropertyRestrictions() {
                return true;
            }
View Full Code Here

        SolrServer solrServer = TestUtils.createSolrServer();
        SolrInputDocument document = new SolrInputDocument();
        document.addField("path_exact", "/a/b");
        document.addField("name", "hello");
        solrServer.add(document);
        solrServer.commit();
        OakSolrConfiguration configuration = new DefaultSolrConfiguration() {
            @Override
            public boolean useForPropertyRestrictions() {
                return true;
            }
View Full Code Here

        Nutch.ARG_BATCH, batchId));
    // do the commits once and for all the reducers in one go
    getConf().set(SolrConstants.SERVER_URL,solrUrl);
    SolrServer solr = SolrUtils.getCommonsHttpSolrServer(getConf());
    if (getConf().getBoolean(SolrConstants.COMMIT_INDEX, true)) {
      solr.commit();
    }
    LOG.info("SolrIndexerJob: done.");
  }

  public int run(String[] args) throws Exception {
View Full Code Here

    }
    SolrServer solrServer = SolrCoreManager.getInstance(bundleContext,
        managedSolrServer).getServer();
    try {
      solrServer.add(doc);
      solrServer.commit();
      log.debug("Documents are committed to Solr Server successfully.");
    } catch (SolrServerException e) {
      log.error("Solr Server Exception", e);
    } catch (IOException e) {
      log.error("IOException", e);
View Full Code Here

    addSolrSpecificFields(sci, doc, ldProgramName);
    SolrServer solrServer = SolrCoreManager.getInstance(bundleContext,
        managedSolrServer).getServer(ldProgramName);
    try {
      solrServer.add(doc);
      solrServer.commit();
      log.debug("Documents are committed to Solr Server successfully.");
    } catch (SolrServerException e) {
      log.error("Solr Server Exception", e);
      throw new StoreException(e.getMessage(), e);
    } catch (IOException 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.