Example usage for org.apache.lucene.index IndexFileNames fileNameFromGeneration

List of usage examples for org.apache.lucene.index IndexFileNames fileNameFromGeneration

Introduction

In this page you can find the example usage for org.apache.lucene.index IndexFileNames fileNameFromGeneration.

Prototype

public static String fileNameFromGeneration(String base, String ext, long gen) 

Source Link

Document

Computes the full file name from base, extension and generation.

Usage

From source file:org.codelibs.elasticsearch.common.lucene.Lucene.java

License:Apache License

/**
 * Reads the segments infos from the given commit, failing if it fails to load
 *//* w  w  w.  j  ava  2 s.  c  om*/
public static SegmentInfos readSegmentInfos(IndexCommit commit) throws IOException {
    // Using commit.getSegmentsFileName() does NOT work here, have to
    // manually create the segment filename
    String filename = IndexFileNames.fileNameFromGeneration(IndexFileNames.SEGMENTS, "",
            commit.getGeneration());
    return SegmentInfos.readCommit(commit.getDirectory(), filename);
}