Example usage for org.apache.solr.store.hdfs HdfsDirectory toString

List of usage examples for org.apache.solr.store.hdfs HdfsDirectory toString

Introduction

In this page you can find the example usage for org.apache.solr.store.hdfs HdfsDirectory toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:org.apache.mahout.text.LuceneSegmentInputSplit.java

License:Apache License

/**
 * Get the {@link SegmentInfo} of this {@link InputSplit} via the given {@link Configuration}
 *
 * @param configuration the configuration used to locate the index
 * @return the segment info or throws exception if not found
 * @throws IOException if an error occurs when accessing the directory
 *///  w  ww  .  jav  a2  s .co m
public SegmentCommitInfo getSegment(Configuration configuration) throws IOException {
    HdfsDirectory directory = new HdfsDirectory(indexPath, configuration);

    SegmentInfos segmentInfos = new SegmentInfos();
    segmentInfos.read(directory);

    for (SegmentCommitInfo segmentInfo : segmentInfos) {
        if (segmentInfo.info.name.equals(segmentInfoName)) {
            return segmentInfo;
        }
    }

    throw new IllegalArgumentException(
            "No such segment: '" + segmentInfoName + "' in directory " + directory.toString());
}