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

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

Introduction

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

Prototype

public byte[] getId() 

Source Link

Document

Since Lucene 5.0, every commit (segments_N) writes a unique id.

Usage

From source file:org.elasticsearch.index.engine.CommitStats.java

License:Apache License

public CommitStats(SegmentInfos segmentInfos) {
    // clone the map to protect against concurrent changes
    userData = MapBuilder.<String, String>newMapBuilder().putAll(segmentInfos.getUserData()).immutableMap();
    // lucene calls the current generation, last generation.
    generation = segmentInfos.getLastGeneration();
    if (segmentInfos.getId() != null) { // id is only written starting with Lucene 5.0
        id = Base64.encodeBytes(segmentInfos.getId());
    }/* ww  w . jav  a 2  s .c o m*/
    numDocs = Lucene.getNumDocs(segmentInfos);
}