Package org.apache.solr.update

Examples of org.apache.solr.update.CommitUpdateCommand


   
    boolean optimize = params.getBool( UpdateParams.OPTIMIZE, false );
    boolean commit   = params.getBool( UpdateParams.COMMIT,   false );
   
    if( optimize || commit || force ) {
      CommitUpdateCommand cmd = new CommitUpdateCommand( optimize );
      cmd.waitFlush    = params.getBool( UpdateParams.WAIT_FLUSH,    cmd.waitFlush    );
      cmd.waitSearcher = params.getBool( UpdateParams.WAIT_SEARCHER, cmd.waitSearcher );
      cmd.expungeDeletes = params.getBool( UpdateParams.EXPUNGE_DELETES, cmd.expungeDeletes);
      cmd.maxOptimizeSegments = params.getInt(UpdateParams.MAX_OPTIMIZE_SEGMENTS, cmd.maxOptimizeSegments);
      req.getCore().getUpdateHandler().commit( cmd );
View Full Code Here


   
    boolean optimize = params.getBool( UpdateParams.OPTIMIZE, false );
    boolean commit   = params.getBool( UpdateParams.COMMIT,   false );
   
    if( optimize || commit || force ) {
      CommitUpdateCommand cmd = new CommitUpdateCommand( optimize );
      cmd.waitFlush    = params.getBool( UpdateParams.WAIT_FLUSH,    cmd.waitFlush    );
      cmd.waitSearcher = params.getBool( UpdateParams.WAIT_SEARCHER, cmd.waitSearcher );
      cmd.expungeDeletes = params.getBool( UpdateParams.EXPUNGE_DELETES, cmd.expungeDeletes);     
      cmd.maxOptimizeSegments = params.getInt(UpdateParams.MAX_OPTIMIZE_SEGMENTS, cmd.maxOptimizeSegments);
      processor.processCommit( cmd );
View Full Code Here

            } else {
              assertEvent(ev2, JSONParser.OBJECT_START);
            }
          }
          else if( v.equals( XmlUpdateRequestHandler.COMMIT ) ) {
            CommitUpdateCommand cmd = new CommitUpdateCommand(false);
            cmd.waitFlush = cmd.waitSearcher = true;
            parseCommitOptions( cmd );
            processor.processCommit( cmd );
          }
          else if( v.equals( XmlUpdateRequestHandler.OPTIMIZE ) ) {
            CommitUpdateCommand cmd = new CommitUpdateCommand(true);
            cmd.waitFlush = cmd.waitSearcher = true;
            parseCommitOptions( cmd );
            processor.processCommit( cmd );
          }
          else if( v.equals( XmlUpdateRequestHandler.DELETE ) ) {
View Full Code Here

//              throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unexpected <doc> tag without an <add> tag surrounding it.");
//            }
          } else if (XmlUpdateRequestHandler.COMMIT.equals(currTag) || XmlUpdateRequestHandler.OPTIMIZE.equals(currTag)) {
            XmlUpdateRequestHandler.log.trace("parsing " + currTag);

            CommitUpdateCommand cmd = new CommitUpdateCommand(XmlUpdateRequestHandler.OPTIMIZE.equals(currTag));

            boolean sawWaitSearcher = false, sawWaitFlush = false;
            for (int i = 0; i < parser.getAttributeCount(); i++) {
              String attrName = parser.getAttributeLocalName(i);
              String attrVal = parser.getAttributeValue(i);
View Full Code Here

    }
  }

  public void commit(boolean optimize) {
    try {
      CommitUpdateCommand commit = new CommitUpdateCommand(optimize);
      processor.processCommit(commit);
    } catch (Throwable t) {
      log.error("Exception while solr commit.", t);
    }
  }
View Full Code Here

            } else {
              assertEvent(ev2, JSONParser.OBJECT_START);
            }
          }
          else if( v.equals( XmlUpdateRequestHandler.COMMIT ) ) {
            CommitUpdateCommand cmd = new CommitUpdateCommand(false);
            cmd.waitFlush = cmd.waitSearcher = true;
            parseCommitOptions( cmd );
            processor.processCommit( cmd );
          }
          else if( v.equals( XmlUpdateRequestHandler.OPTIMIZE ) ) {
            CommitUpdateCommand cmd = new CommitUpdateCommand(true);
            cmd.waitFlush = cmd.waitSearcher = true;
            parseCommitOptions( cmd );
            processor.processCommit( cmd );
          }
          else if( v.equals( XmlUpdateRequestHandler.DELETE ) ) {
View Full Code Here

            addCmd.solrDoc = readDoc(parser);
            processor.processAdd(addCmd);
          } else if (XmlUpdateRequestHandler.COMMIT.equals(currTag) || XmlUpdateRequestHandler.OPTIMIZE.equals(currTag)) {
            XmlUpdateRequestHandler.log.trace("parsing " + currTag);

            CommitUpdateCommand cmd = new CommitUpdateCommand(XmlUpdateRequestHandler.OPTIMIZE.equals(currTag));

            boolean sawWaitSearcher = false, sawWaitFlush = false;
            for (int i = 0; i < parser.getAttributeCount(); i++) {
              String attrName = parser.getAttributeLocalName(i);
              String attrVal = parser.getAttributeValue(i);
View Full Code Here

    }
    return sb;
  }

  private void doCommit() throws IOException {
    CommitUpdateCommand cmd = new CommitUpdateCommand(false);
    cmd.waitFlush = true;
    cmd.waitSearcher = true;
    solrCore.getUpdateHandler().commit(cmd);
    if (solrCore.getUpdateHandler() instanceof DirectUpdateHandler2) {
      LOG.info("Force open index writer to make sure older index files get deleted");
View Full Code Here

    assertEquals(false, !add.allowDups);
   

    // parse the commit commands
    assertEquals( 2, p.commitCommands.size() );
    CommitUpdateCommand commit = p.commitCommands.get( 0 );
    assertFalse( commit.optimize );
    assertTrue( commit.waitFlush );
    assertTrue( commit.waitSearcher );
   
    commit = p.commitCommands.get( 1 );
View Full Code Here

    }
  }

  public void commit(boolean optimize) {
    try {
      CommitUpdateCommand commit = new CommitUpdateCommand(optimize);
      processor.processCommit(commit);
    } catch (Exception e) {
      LOG.log(Level.SEVERE, "Exception while solr commit.", e);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.solr.update.CommitUpdateCommand

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.