Example usage for org.apache.solr.update UpdateLog getLastLogId

List of usage examples for org.apache.solr.update UpdateLog getLastLogId

Introduction

In this page you can find the example usage for org.apache.solr.update UpdateLog getLastLogId.

Prototype

public long getLastLogId() 

Source Link

Usage

From source file:jp.sf.fess.solr.plugin.update.SuggestTranslogUpdateHandlerFilter.java

License:Apache License

@Override
public void commit(final CommitUpdateCommand cmd, final UpdateHandlerFilterChain chain) throws IOException {
    final UpdateLog ulog = updateHandler.getUpdateLog();
    final File logDir = new File(ulog.getLogDir());
    final long lastLogId = ulog.getLastLogId();
    final String lastLogName = String.format(Locale.ROOT, UpdateLog.LOG_FILENAME_PATTERN, UpdateLog.TLOG_NAME,
            lastLogId);/*  ww  w.  ja v a 2s  .  co  m*/

    chain.commit(cmd);

    final File logFile = new File(logDir, lastLogName);
    if (logFile.exists()) {
        if (logger.isInfoEnabled()) {
            logger.info("Create " + logFile.getAbsolutePath());
        }
        suggestUpdateController.addTransactionLog(logFile);
    } else {
        if (logger.isInfoEnabled()) {
            logger.info(logFile.getName() + " does not exist.");
        }
    }
}