Example usage for org.apache.lucene.index SegmentInfos getLastCommitGeneration

List of usage examples for org.apache.lucene.index SegmentInfos getLastCommitGeneration

Introduction

In this page you can find the example usage for org.apache.lucene.index SegmentInfos getLastCommitGeneration.

Prototype

public static long getLastCommitGeneration(Directory directory) throws IOException 

Source Link

Document

Get the generation of the most recent commit to the index in this directory (N in the segments_N file).

Usage

From source file:org.lahab.clucene.server.indexer.Indexer.java

License:Apache License

@Override
public Collection<? extends String> record() {
    try {//from w  w  w.java  2 s  .  c o m
        int nbDoc = _close ? 0 : _index.numDocs();
        List<String> stats = new LinkedList<String>();
        stats.add(String.valueOf(nbDoc));
        stats.add(String.valueOf(SegmentInfos.getLastCommitGeneration(_directory)));
        stats.add(String.valueOf(_close ? 0 : _index.ramSizeInBytes()));
        LOGGER.info("Doc added:" + nbDoc);
        return stats;
    } catch (IOException e) {
        e.printStackTrace();
    }
    return null;

}