java.lang.Object | ||||
↳ | java.util.AbstractCollection<E> | |||
↳ | java.util.AbstractList<E> | |||
↳ | java.util.Vector<E> | |||
↳ | org.apache.lucene.index.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 Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
SegmentInfos.FindSegmentsFile | Utility class for executing code that needs to do something with the current segments file. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | FORMAT | The file format version, a negative number. | |||||||||
int | FORMAT_CHECKSUM | This format adds a checksum at the end of the file to ensure all bytes were successfully written. | |||||||||
int | FORMAT_DEL_COUNT | This format adds the deletion count for each segment. | |||||||||
int | FORMAT_DIAGNOSTICS | This format adds optional per-segment String diagnostics storage, and switches userData to Map | |||||||||
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) | |||||||||
int | FORMAT_LOCKLESS | This format adds details used for lockless commits. | |||||||||
int | FORMAT_SHARED_DOC_STORE | This format allows multiple segments to share a single vectors and stored fields file. | |||||||||
int | FORMAT_SINGLE_NORM_FILE | This format adds a "hasSingleNormFile" flag into each segment info. | |||||||||
int | FORMAT_USER_DATA | This format adds optional commit userData (String) storage. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
counter |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.util.Vector
| |||||||||||
From class
java.util.AbstractList
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns a copy of this instance, also copying each
SegmentInfo.
| |||||||||||
Returns all file names referenced by SegmentInfo
instances matching the provided Directory (ie files
associated with any "external" segments are skipped).
| |||||||||||
Parse the generation off the segments file name and
return it.
| |||||||||||
Get the filename of the current segments_N file
in the directory.
| |||||||||||
Get the filename of the current segments_N file
from a list of files.
| |||||||||||
Get the segments_N filename in use by this segment infos.
| |||||||||||
Get the generation (N) of the current segments_N file
in the directory.
| |||||||||||
Get the generation (N) of the current segments_N file
from a list of files.
| |||||||||||
Get the next segments_N filename that will be written.
| |||||||||||
version number when this SegmentInfos was generated.
| |||||||||||
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.
| |||||||||||
Read a particular segmentFileName.
| |||||||||||
This version of read uses the retry logic (for lock-less
commits) to find the right segments file to load.
| |||||||||||
Returns userData from latest segments file
| |||||||||||
Current version number from segments file.
| |||||||||||
Advanced: set how many times to try loading the
segments.gen file contents to determine current segment
generation.
| |||||||||||
Advanced: set how many milliseconds to pause in between
attempts to load the segments.gen file.
| |||||||||||
Advanced: set how many times to try incrementing the
gen when loading the segments file.
| |||||||||||
If non-null, information about retries when loading
the segments file will be printed to this.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.util.Vector
| |||||||||||
From class
java.util.AbstractList
| |||||||||||
From class
java.util.AbstractCollection
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.lang.Iterable
| |||||||||||
From interface
java.util.Collection
| |||||||||||
From interface
java.util.List
|
The file format version, a negative number.
This format adds a checksum at the end of the file to ensure all bytes were successfully written.
This format adds the deletion count for each segment. This way IndexWriter can efficiently report numDocs().
This format adds optional per-segment String diagnostics storage, and switches userData to Map
This format adds the boolean hasProx to record if any fields in the segment store prox information (ie, have omitTermFreqAndPositions==false)
This format adds details used for lockless commits. It differs slightly from the previous format in that file names are never re-used (write once). Instead, each file is written to the next generation. For example, segments_1, segments_2, etc. This allows us to not use a commit lock. See file formats for details.
This format allows multiple segments to share a single vectors and stored fields file.
This format adds a "hasSingleNormFile" flag into each segment info. See LUCENE-756 for details.
This format adds optional commit userData (String) storage.
Returns all file names referenced by SegmentInfo instances matching the provided Directory (ie files associated with any "external" segments are skipped). The returned collection is recomputed on each invocation.
IOException |
---|
Parse the generation off the segments file name and return it.
Get the filename of the current segments_N file in the directory.
directory | -- directory to search for the latest segments_N file |
---|
IOException |
---|
Get the filename of the current segments_N file from a list of files.
files | -- array of file names to check |
---|
IOException |
---|
Get the segments_N filename in use by this segment infos.
Get the generation (N) of the current segments_N file in the directory.
directory | -- directory to search for the latest segments_N file |
---|
IOException |
---|
Get the generation (N) of the current segments_N file from a list of files.
files | -- array of file names to check |
---|
version number when this SegmentInfos was generated.
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.
Read a particular segmentFileName. Note that this may throw an IOException if a commit is in process.
directory | -- directory containing the segments file |
---|---|
segmentFileName | -- segment file to load |
CorruptIndexException | if the index is corrupt |
---|---|
IOException | if there is a low-level IO error |
This version of read uses the retry logic (for lock-less commits) to find the right segments file to load.
CorruptIndexException | if the index is corrupt |
---|---|
IOException | if there is a low-level IO error |
Returns userData from latest segments file
CorruptIndexException | if the index is corrupt |
---|---|
IOException | if there is a low-level IO error |
Current version number from segments file.
CorruptIndexException | if the index is corrupt |
---|---|
IOException | if there is a low-level IO error |
Advanced: set how many times to try loading the segments.gen file contents to determine current segment generation. This file is only referenced when the primary method (listing the directory) fails.
Advanced: set how many milliseconds to pause in between attempts to load the segments.gen file.
Advanced: set how many times to try incrementing the gen when loading the segments file. This only runs if the primary (listing directory) and secondary (opening segments.gen file) methods fail to find the segments file.
If non-null, information about retries when loading the segments file will be printed to this.