|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection<E> java.util.AbstractList<E> java.util.Vector<SegmentInfo> org.apache.lucene.index.SegmentInfos
public final class SegmentInfos
A collection of segmentInfo objects with methods for operating on those segments in relation to the file system.
NOTE: This API is new and still experimental (subject to change suddenly in the next release)
Nested Class Summary | |
---|---|
static class |
SegmentInfos.FindSegmentsFile
Utility class for executing code that needs to do something with the current segments file. |
Field Summary | |
---|---|
int |
counter
|
static int |
FORMAT
The file format version, a negative number. |
static int |
FORMAT_CHECKSUM
This format adds a checksum at the end of the file to ensure all bytes were successfully written. |
static int |
FORMAT_DEL_COUNT
This format adds the deletion count for each segment. |
static int |
FORMAT_DIAGNOSTICS
This format adds optional per-segment String diagnostics storage, and switches userData to Map |
static int |
FORMAT_HAS_PROX
This format adds the boolean hasProx to record if any fields in the segment store prox information (ie, have omitTermFreqAndPositions==false) |
static int |
FORMAT_LOCKLESS
This format adds details used for lockless commits. |
static int |
FORMAT_SHARED_DOC_STORE
This format allows multiple segments to share a single vectors and stored fields file. |
static int |
FORMAT_SINGLE_NORM_FILE
This format adds a "hasSingleNormFile" flag into each segment info. |
static int |
FORMAT_USER_DATA
This format adds optional commit userData (String) storage. |
Fields inherited from class java.util.Vector |
---|
capacityIncrement, elementCount, elementData |
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
SegmentInfos()
|
Method Summary | |
---|---|
Object |
clone()
Returns a copy of this instance, also copying each SegmentInfo. |
Collection<String> |
files(Directory dir,
boolean includeSegmentsFile)
Returns all file names referenced by SegmentInfo instances matching the provided Directory (ie files associated with any "external" segments are skipped). |
static long |
generationFromSegmentsFileName(String fileName)
Parse the generation off the segments file name and return it. |
String |
getCurrentSegmentFileName()
Get the segments_N filename in use by this segment infos. |
static String |
getCurrentSegmentFileName(Directory directory)
Get the filename of the current segments_N file in the directory. |
static String |
getCurrentSegmentFileName(String[] files)
Get the filename of the current segments_N file from a list of files. |
static long |
getCurrentSegmentGeneration(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 int |
getDefaultGenFileRetryCount()
|
static int |
getDefaultGenFileRetryPauseMsec()
|
static int |
getDefaultGenLookahedCount()
|
long |
getGeneration()
|
static PrintStream |
getInfoStream()
|
long |
getLastGeneration()
|
String |
getNextSegmentFileName()
Get the next segments_N filename that will be written. |
Map<String,String> |
getUserData()
|
long |
getVersion()
version number when this SegmentInfos was generated. |
boolean |
hasExternalSegments(Directory dir)
|
SegmentInfo |
info(int i)
|
SegmentInfos |
range(int first,
int last)
Returns a new SegmentInfos containing the SegmentInfo instances in the specified range first (inclusive) to last (exclusive), so total number of segments returned is last-first. |
void |
read(Directory directory)
This version of read uses the retry logic (for lock-less commits) to find the right segments file to load. |
void |
read(Directory directory,
String segmentFileName)
Read a particular segmentFileName. |
static Map<String,String> |
readCurrentUserData(Directory directory)
Returns userData from latest segments file |
static long |
readCurrentVersion(Directory directory)
Current version number from segments file. |
String |
segString(Directory directory)
|
static void |
setDefaultGenFileRetryCount(int count)
Advanced: set how many times to try loading the segments.gen file contents to determine current segment generation. |
static void |
setDefaultGenFileRetryPauseMsec(int msec)
Advanced: set how many milliseconds to pause in between attempts to load the segments.gen file. |
static void |
setDefaultGenLookaheadCount(int count)
Advanced: set how many times to try incrementing the gen when loading the segments file. |
static void |
setInfoStream(PrintStream infoStream)
If non-null, information about retries when loading the segments file will be printed to this. |
Methods inherited from class java.util.Vector |
---|
add, add, addAll, addAll, addElement, capacity, clear, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize |
Methods inherited from class java.util.AbstractList |
---|
iterator, listIterator, listIterator |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
iterator, listIterator, listIterator |
Field Detail |
---|
public static final int FORMAT
public static final int FORMAT_LOCKLESS
public static final int FORMAT_SINGLE_NORM_FILE
public static final int FORMAT_SHARED_DOC_STORE
public static final int FORMAT_CHECKSUM
public static final int FORMAT_DEL_COUNT
public static final int FORMAT_HAS_PROX
public static final int FORMAT_USER_DATA
public static final int FORMAT_DIAGNOSTICS
public int counter
Constructor Detail |
---|
public SegmentInfos()
Method Detail |
---|
public final SegmentInfo info(int i)
public static long getCurrentSegmentGeneration(String[] files)
files
- -- array of file names to checkpublic static long getCurrentSegmentGeneration(Directory directory) throws IOException
directory
- -- directory to search for the latest segments_N file
IOException
public static String getCurrentSegmentFileName(String[] files) throws IOException
files
- -- array of file names to check
IOException
public static String getCurrentSegmentFileName(Directory directory) throws IOException
directory
- -- directory to search for the latest segments_N file
IOException
public String getCurrentSegmentFileName()
public static long generationFromSegmentsFileName(String fileName)
public String getNextSegmentFileName()
public final void read(Directory directory, String segmentFileName) throws CorruptIndexException, IOException
directory
- -- directory containing the segments filesegmentFileName
- -- segment file to load
CorruptIndexException
- if the index is corrupt
IOException
- if there is a low-level IO errorpublic final void read(Directory directory) throws CorruptIndexException, IOException
CorruptIndexException
- if the index is corrupt
IOException
- if there is a low-level IO errorpublic Object clone()
clone
in class Vector<SegmentInfo>
public long getVersion()
public long getGeneration()
public long getLastGeneration()
public static long readCurrentVersion(Directory directory) throws CorruptIndexException, IOException
CorruptIndexException
- if the index is corrupt
IOException
- if there is a low-level IO errorpublic static Map<String,String> readCurrentUserData(Directory directory) throws CorruptIndexException, IOException
CorruptIndexException
- if the index is corrupt
IOException
- if there is a low-level IO errorpublic static void setInfoStream(PrintStream infoStream)
public static void setDefaultGenFileRetryCount(int count)
public static int getDefaultGenFileRetryCount()
setDefaultGenFileRetryCount(int)
public static void setDefaultGenFileRetryPauseMsec(int msec)
public static int getDefaultGenFileRetryPauseMsec()
setDefaultGenFileRetryPauseMsec(int)
public static void setDefaultGenLookaheadCount(int count)
public static int getDefaultGenLookahedCount()
setDefaultGenLookaheadCount(int)
public static PrintStream getInfoStream()
setInfoStream(java.io.PrintStream)
public SegmentInfos range(int first, int last)
public Collection<String> files(Directory dir, boolean includeSegmentsFile) throws IOException
IOException
public String segString(Directory directory)
public Map<String,String> getUserData()
public boolean hasExternalSegments(Directory dir)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |