## org.apache.hadoop.contrib.index.lucene
Class LuceneUtil

    java.lang.Object
      org.apache.hadoop.contrib.index.lucene.LuceneUtil

    public final class LuceneUtil

extends Object

This class copies some methods from Lucene's SegmentInfos since that class is not public.

Constructor Summary
`LuceneUtil()`

Method Summary
`static long` `generationFromSegmentsFileName(String fileName)` Parse the generation off the segments file name and return it.
`static long` `getCurrentSegmentGeneration(org.apache.lucene.store.Directory directory)` Get the generation (N) of the current segments_N file in the directory.
`static long` `getCurrentSegmentGeneration(String[] files)` Get the generation (N) of the current segments_N file from a list of files.
`static boolean` `isSegmentsFile(String name)` Check if the file is a segments_N file
`static boolean` `isSegmentsGenFile(String name)` Check if the file is the segments.gen file

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LuceneUtil

    public LuceneUtil()

Method Detail

### isSegmentsFile

    public static boolean isSegmentsFile(String name)

  Check if the file is a segments_N file

  Parameters:
    `name` -
  Returns:
    true if the file is a segments_N file

### isSegmentsGenFile

    public static boolean isSegmentsGenFile(String name)

  Check if the file is the segments.gen file

  Parameters:
    `name` -
  Returns:
    true if the file is the segments.gen file

### getCurrentSegmentGeneration

    public static long getCurrentSegmentGeneration(org.apache.lucene.store.Directory directory)
                                            throws IOException

  Get the generation (N) of the current segments_N file in the directory.

  Parameters:
    `directory` - -- directory to search for the latest segments_N file
  Throws:
    `IOException`

### getCurrentSegmentGeneration

    public static long getCurrentSegmentGeneration(String[] files)

  Get the generation (N) of the current segments_N file from a list of files.

  Parameters:
    `files` - -- array of file names to check

### generationFromSegmentsFileName

    public static long generationFromSegmentsFileName(String fileName)

  Parse the generation off the segments file name and return it.

Copyright © 2009 The Apache Software Foundation