Example usage for org.apache.lucene.index DirectoryReader getIndexCommit

List of usage examples for org.apache.lucene.index DirectoryReader getIndexCommit

Introduction

In this page you can find the example usage for org.apache.lucene.index DirectoryReader getIndexCommit.

Prototype

public abstract IndexCommit getIndexCommit() throws IOException;

Source Link

Document

Expert: return the IndexCommit that this reader has opened.

Usage

From source file:org.niord.core.message.MessageLuceneIndex.java

License:Apache License

/**
 * Returns the last updated time/*from  w w w. java  2s . c o m*/
 * @return the last updated time
 */
private Date getLastUpdated() {
    try {
        DirectoryReader reader = getIndexReader();
        if (reader.getIndexCommit().getUserData().containsKey(LUCENE_LAST_UPDATE)) {
            return new Date(Long.valueOf(reader.getIndexCommit().getUserData().get(LUCENE_LAST_UPDATE)));
        }
    } catch (Exception e) {
        log.debug("Could not get last-updated flag from index reader");
    }
    return new Date(0);
}