Package org.apache.solr.client.solrj

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


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

  @After
  @Override
  public void tearDown() throws Exception {
View Full Code Here


        } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_ADD_BEAN)) {
            serverToUse.addBean(exchange.getIn().getBody());
        } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_ADD_BEANS)) {
            serverToUse.addBeans(exchange.getIn().getBody(Collection.class));
        } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_COMMIT)) {
            serverToUse.commit();
        } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_ROLLBACK)) {
            serverToUse.rollback();
        } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_OPTIMIZE)) {
            serverToUse.optimize();
        } else {
View Full Code Here

    Date now = new Date();
    doc.addField("date", DateUtil.getThreadLocalDateFormat().format(now));//<co id="co.solrj.date"/>
    doc.addField("description", description);
    doc.addField("categories_t", "Fairy Tale, Sports");//<co id="co.solrj.dynamic.field"/>
    solr.add(doc);//<co id="co.solrj.add"/>
    solr.commit();//<co id="co.solrj.commit"/>
    /*
    <calloutlist>
    <callout arearefs="co.solrj.server"><para>Create a HTTP-based Solr Server connection.</para></callout>
      <callout arearefs="co.solrj.unique"><para>The schema used for this instance of Solr requires a unique field named "id"</para></callout>
      <callout arearefs="co.solrj.title"><para>Add a Title field to our document and boost it to be 5 times as important as the other fields</para></callout>
View Full Code Here

              + " of something that is very important.");
      docs.add(doc);
    }

    solr.add(docs);
    solr.commit();
    solr.optimize();
    //<start id="solrj-search-1"/>
    SolrQuery queryParams = new SolrQuery();//<co id="solrj-search.co.query"/>
    queryParams.setFields("description", "title");//<co id="solrj-search.co.fields"/>
    queryParams.setQuery("description:win OR description:all");//<co id="solrj-search.co.terms"/>
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();
      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

      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);
      solr.commit();
    } finally {
      FileSystem.get(getConf()).delete(
          FileOutputFormat.getOutputPath(currentJob), true);
    }
    LOG.info("SolrIndexerJob: done.");
View Full Code Here

        boolean isSuccess = false;
        try {
            SolrServer solrServer = this.getSolrClient();
            solrServer.addBeans(indexBeans);
            solrServer.optimize();
            solrServer.commit();
            logger.info("Add or Update index beans request commit success! " + indexBeans);
            isSuccess = true;
        } catch (SolrServerException e) {
            logger.error(e.toString());
        } catch (IOException e) {
View Full Code Here

                }
                solrServer.add(solrInputDocument);
            }
           
            solrServer.optimize();
            solrServer.commit();
            logger.info("Add or Update index request commit success! " + indexDocuments);
            isSuccess = true;
        } catch (SolrServerException e) {
            logger.error(e.toString());
        } catch (IOException e) {
View Full Code Here

                    deleteFile( stashFilePath );
                }

            }
            server.add(docs);
            server.commit();
        }
        catch (SolrServerException e)
        {
            log.error("Unable to Stash pointers", e);
            e.printStackTrace();
View Full Code Here

     
     
      // Add Docs to Server & Commit
      // Records will not be stored into Index until commit is performed.
      server.add(docs);
      server.commit();
    }
    catch (Exception e)
    {
      SSAFSolrException ssafException =  new SSAFSolrException();
      ssafException.setFatalError(SSAFSolrErrorCodes.UNABLE_TO_STASH);
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.