Lucene++ - a full-featured, c++ search engine
API Documentation
A collection of SegmentInfo objects with methods for operating on those segments in relation to the file system. More...
#include <SegmentInfos.h>
Public Member Functions | |
SegmentInfos () | |
virtual | ~SegmentInfos () |
virtual String | getClassName () |
boost::shared_ptr< SegmentInfos > | shared_from_this () |
SegmentInfoPtr | info (int32_t i) |
String | getCurrentSegmentFileName () |
String | getNextSegmentFileName () |
void | read (DirectoryPtr directory, const String &segmentFileName) |
Read a particular segmentFileName. Note that this may throw an IOException if a commit is in process. More... | |
void | read (DirectoryPtr directory) |
This version of read uses the retry logic (for lock-less commits) to find the right segments file to load. More... | |
virtual LuceneObjectPtr | clone (LuceneObjectPtr other=LuceneObjectPtr()) |
Returns a copy of this instance, also copying each SegmentInfo. More... | |
int64_t | getVersion () |
Version number when this SegmentInfos was generated. More... | |
int64_t | getGeneration () |
int64_t | getLastGeneration () |
SegmentInfosPtr | range (int32_t first, int32_t 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. More... | |
void | updateGeneration (SegmentInfosPtr other) |
Carry over generation numbers from another SegmentInfos. More... | |
void | rollbackCommit (DirectoryPtr dir) |
void | prepareCommit (DirectoryPtr dir) |
Call this to start a commit. This writes the new segments file, but writes an invalid checksum at the end, so that it is not visible to readers. Once this is called you must call. finishCommit to complete the commit or rollbackCommit to abort it. More... | |
HashSet< String > | files (DirectoryPtr dir, bool includeSegmentsFile) |
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. More... | |
void | finishCommit (DirectoryPtr dir) |
void | commit (DirectoryPtr dir) |
Writes & syncs to the Directory dir, taking care to remove the segments file on exception. More... | |
String | segString (DirectoryPtr directory) |
MapStringString | getUserData () |
void | setUserData (MapStringString data) |
void | replace (SegmentInfosPtr other) |
Replaces all segments in this instance, but keeps generation, version, counter so that future commits remain write once. More... | |
bool | hasExternalSegments (DirectoryPtr dir) |
![]() | |
SegmentInfoCollection () | |
virtual | ~SegmentInfoCollection () |
boost::shared_ptr < SegmentInfoCollection > | shared_from_this () |
int32_t | size () |
bool | empty () |
void | clear () |
void | add (SegmentInfoPtr info) |
void | add (int32_t pos, SegmentInfoPtr info) |
void | addAll (SegmentInfoCollectionPtr segmentInfos) |
bool | equals (SegmentInfoCollectionPtr other) |
int32_t | find (SegmentInfoPtr info) |
bool | contains (SegmentInfoPtr info) |
void | remove (int32_t pos) |
void | remove (int32_t start, int32_t end) |
![]() | |
virtual | ~LuceneObject () |
virtual void | initialize () |
Called directly after instantiation to create objects that depend on this object being fully constructed. More... | |
virtual int32_t | hashCode () |
Return hash code for this object. More... | |
virtual bool | equals (LuceneObjectPtr other) |
Return whether two objects are equal. More... | |
virtual int32_t | compareTo (LuceneObjectPtr other) |
Compare two objects. More... | |
virtual String | toString () |
Returns a string representation of the object. More... | |
![]() | |
virtual | ~LuceneSync () |
virtual SynchronizePtr | getSync () |
Return this object synchronize lock. More... | |
virtual LuceneSignalPtr | getSignal () |
Return this object signal. More... | |
virtual void | lock (int32_t timeout=0) |
Lock this object using an optional timeout. More... | |
virtual void | unlock () |
Unlock this object. More... | |
virtual bool | holdsLock () |
Returns true if this object is currently locked by current thread. More... | |
virtual void | wait (int32_t timeout=0) |
Wait for signal using an optional timeout. More... | |
virtual void | notifyAll () |
Notify all threads waiting for signal. More... | |
Static Public Member Functions | |
static String | _getClassName () |
static int64_t | getCurrentSegmentGeneration (HashSet< String > files) |
static int64_t | getCurrentSegmentGeneration (DirectoryPtr directory) |
static String | getCurrentSegmentFileName (HashSet< String > files) |
static String | getCurrentSegmentFileName (DirectoryPtr directory) |
static int64_t | generationFromSegmentsFileName (const String &fileName) |
static int64_t | readCurrentVersion (DirectoryPtr directory) |
Current version number from segments file. More... | |
static MapStringString | readCurrentUserData (DirectoryPtr directory) |
Returns userData from latest segments file. More... | |
static void | setInfoStream (InfoStreamPtr infoStream) |
If non-null, information about retries when loading the segments file will be printed to this. More... | |
static void | setDefaultGenFileRetryCount (int32_t count) |
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. More... | |
static int32_t | getDefaultGenFileRetryCount () |
static void | setDefaultGenFileRetryPauseMsec (int32_t msec) |
Set how many milliseconds to pause in between attempts to load the segments.gen file. More... | |
static int32_t | getDefaultGenFileRetryPauseMsec () |
static void | setDefaultGenLookaheadCount (int32_t count) |
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. More... | |
static int32_t | getDefaultGenLookahedCount () |
static InfoStreamPtr | getInfoStream () |
static void | message (const String &message) |
![]() | |
static String | _getClassName () |
Data Fields | |
int32_t | counter |
Static Public Attributes | |
static const int32_t | FORMAT |
The file format version, a negative number. Works since counter, the old 1st entry, is always >= 0. More... | |
static const int32_t | FORMAT_LOCKLESS |
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 fileformats for details. More... | |
static const int32_t | FORMAT_SINGLE_NORM_FILE |
This format adds a "hasSingleNormFile" flag into each segment info. More... | |
static const int32_t | FORMAT_SHARED_DOC_STORE |
This format allows multiple segments to share a single vectors and stored fields file. More... | |
static const int32_t | FORMAT_CHECKSUM |
This format adds a checksum at the end of the file to ensure all bytes were successfully written. More... | |
static const int32_t | FORMAT_DEL_COUNT |
This format adds the deletion count for each segment. This way IndexWriter can efficiently report numDocs(). More... | |
static const int32_t | FORMAT_HAS_PROX |
This format adds the boolean hasProx to record if any fields in the segment store prox information (ie, have omitTermFreqAndPositions == false) More... | |
static const int32_t | FORMAT_USER_DATA |
This format adds optional commit userData storage. More... | |
static const int32_t | FORMAT_DIAGNOSTICS |
This format adds optional per-segment string diagnostics storage, and switches userData to Map. More... | |
static const int32_t | CURRENT_FORMAT |
This must always point to the most recent file format. More... | |
Protected Member Functions | |
void | write (DirectoryPtr directory) |
Additional Inherited Members | |
![]() | |
Collection< SegmentInfoPtr > | segmentInfos |
A collection of SegmentInfo objects with methods for operating on those segments in relation to the file system.
Lucene::SegmentInfos::SegmentInfos | ( | ) |
|
virtual |
|
inlinestatic |
|
virtual |
Returns a copy of this instance, also copying each SegmentInfo.
Reimplemented from Lucene::SegmentInfoCollection.
void Lucene::SegmentInfos::commit | ( | DirectoryPtr | dir) |
Writes & syncs to the Directory dir, taking care to remove the segments file on exception.
HashSet<String> Lucene::SegmentInfos::files | ( | DirectoryPtr | dir, |
bool | includeSegmentsFile | ||
) |
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.
void Lucene::SegmentInfos::finishCommit | ( | DirectoryPtr | dir) |
|
static |
|
inlinevirtual |
Reimplemented from Lucene::SegmentInfoCollection.
String Lucene::SegmentInfos::getCurrentSegmentFileName | ( | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
int64_t Lucene::SegmentInfos::getGeneration | ( | ) |
|
static |
int64_t Lucene::SegmentInfos::getLastGeneration | ( | ) |
String Lucene::SegmentInfos::getNextSegmentFileName | ( | ) |
MapStringString Lucene::SegmentInfos::getUserData | ( | ) |
int64_t Lucene::SegmentInfos::getVersion | ( | ) |
Version number when this SegmentInfos was generated.
bool Lucene::SegmentInfos::hasExternalSegments | ( | DirectoryPtr | dir) |
SegmentInfoPtr Lucene::SegmentInfos::info | ( | int32_t | i) |
|
static |
void Lucene::SegmentInfos::prepareCommit | ( | DirectoryPtr | dir) |
Call this to start a commit. This writes the new segments file, but writes an invalid checksum at the end, so that it is not visible to readers. Once this is called you must call. finishCommit to complete the commit or rollbackCommit to abort it.
SegmentInfosPtr Lucene::SegmentInfos::range | ( | int32_t | first, |
int32_t | 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 Lucene::SegmentInfos::read | ( | DirectoryPtr | directory, |
const String & | segmentFileName | ||
) |
Read a particular segmentFileName. Note that this may throw an IOException if a commit is in process.
void Lucene::SegmentInfos::read | ( | DirectoryPtr | directory) |
This version of read uses the retry logic (for lock-less commits) to find the right segments file to load.
|
static |
Returns userData from latest segments file.
|
static |
Current version number from segments file.
void Lucene::SegmentInfos::replace | ( | SegmentInfosPtr | other) |
Replaces all segments in this instance, but keeps generation, version, counter so that future commits remain write once.
void Lucene::SegmentInfos::rollbackCommit | ( | DirectoryPtr | dir) |
String Lucene::SegmentInfos::segString | ( | DirectoryPtr | directory) |
|
static |
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.
|
static |
Set how many milliseconds to pause in between attempts to load the segments.gen file.
|
static |
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.
|
static |
If non-null, information about retries when loading the segments file will be printed to this.
void Lucene::SegmentInfos::setUserData | ( | MapStringString | data) |
|
inline |
void Lucene::SegmentInfos::updateGeneration | ( | SegmentInfosPtr | other) |
Carry over generation numbers from another SegmentInfos.
|
protected |
int32_t Lucene::SegmentInfos::counter |
|
static |
This must always point to the most recent file format.
|
static |
The file format version, a negative number. Works since counter, the old 1st entry, is always >= 0.
|
static |
This format adds a checksum at the end of the file to ensure all bytes were successfully written.
|
static |
This format adds the deletion count for each segment. This way IndexWriter can efficiently report numDocs().
|
static |
This format adds optional per-segment string diagnostics storage, and switches userData to Map.
|
static |
This format adds the boolean hasProx to record if any fields in the segment store prox information (ie, have omitTermFreqAndPositions == false)
|
static |
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 fileformats for details.
|
static |
This format allows multiple segments to share a single vectors and stored fields file.
|
static |
This format adds a "hasSingleNormFile" flag into each segment info.
|
static |
This format adds optional commit userData storage.