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 (const DirectoryPtr &directory, const String &segmentFileName) |
Read a particular segmentFileName. Note that this may throw an IOException if a commit is in process. | |
void | read (const DirectoryPtr &directory) |
This version of read uses the retry logic (for lock-less commits) to find the right segments file to load. | |
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr()) |
Returns a copy of this instance, also copying each SegmentInfo. | |
int64_t | getVersion () |
Version number when this SegmentInfos was generated. | |
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. | |
void | updateGeneration (const SegmentInfosPtr &other) |
Carry over generation numbers from another SegmentInfos. | |
void | rollbackCommit (const DirectoryPtr &dir) |
void | prepareCommit (const 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. | |
HashSet< String > | files (const 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 | finishCommit (const DirectoryPtr &dir) |
void | commit (const DirectoryPtr &dir) |
Writes & syncs to the Directory dir, taking care to remove the segments file on exception. | |
String | segString (const DirectoryPtr &directory) |
MapStringString | getUserData () |
void | setUserData (MapStringString data) |
void | replace (const SegmentInfosPtr &other) |
Replaces all segments in this instance, but keeps generation, version, counter so that future commits remain write once. | |
bool | hasExternalSegments (const DirectoryPtr &dir) |
![]() | |
SegmentInfoCollection () | |
virtual | ~SegmentInfoCollection () |
boost::shared_ptr< SegmentInfoCollection > | shared_from_this () |
int32_t | size () |
bool | empty () |
void | clear () |
void | add (const SegmentInfoPtr &info) |
void | add (int32_t pos, const SegmentInfoPtr &info) |
void | addAll (const SegmentInfoCollectionPtr &segmentInfos) |
bool | equals (const LuceneObjectPtr &other) |
Return whether two objects are equal. | |
int32_t | find (const SegmentInfoPtr &info) |
bool | contains (const 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. | |
virtual int32_t | hashCode () |
Return hash code for this object. | |
virtual int32_t | compareTo (const LuceneObjectPtr &other) |
Compare two objects. | |
virtual String | toString () |
Returns a string representation of the object. | |
![]() | |
virtual | ~LuceneSync () |
virtual SynchronizePtr | getSync () |
Return this object synchronize lock. | |
virtual LuceneSignalPtr | getSignal () |
Return this object signal. | |
virtual void | lock (int32_t timeout=0) |
Lock this object using an optional timeout. | |
virtual void | unlock () |
Unlock this object. | |
virtual bool | holdsLock () |
Returns true if this object is currently locked by current thread. | |
virtual void | wait (int32_t timeout=0) |
Wait for signal using an optional timeout. | |
virtual void | notifyAll () |
Notify all threads waiting for signal. | |
Static Public Member Functions | |
static String | _getClassName () |
static int64_t | getCurrentSegmentGeneration (HashSet< String > files) |
static int64_t | getCurrentSegmentGeneration (const DirectoryPtr &directory) |
static String | getCurrentSegmentFileName (HashSet< String > files) |
static String | getCurrentSegmentFileName (const DirectoryPtr &directory) |
static int64_t | generationFromSegmentsFileName (const String &fileName) |
static int64_t | readCurrentVersion (const DirectoryPtr &directory) |
Current version number from segments file. | |
static MapStringString | readCurrentUserData (const DirectoryPtr &directory) |
Returns userData from latest segments file. | |
static void | setInfoStream (const InfoStreamPtr &infoStream) |
If non-null, information about retries when loading the segments file will be printed to this. | |
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. | |
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. | |
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. | |
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. | |
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. | |
static const int32_t | FORMAT_SINGLE_NORM_FILE |
This format adds a "hasSingleNormFile" flag into each segment info. | |
static const int32_t | FORMAT_SHARED_DOC_STORE |
This format allows multiple segments to share a single vectors and stored fields file. | |
static const int32_t | FORMAT_CHECKSUM |
This format adds a checksum at the end of the file to ensure all bytes were successfully written. | |
static const int32_t | FORMAT_DEL_COUNT |
This format adds the deletion count for each segment. This way IndexWriter can efficiently report numDocs(). | |
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) | |
static const int32_t | FORMAT_USER_DATA |
This format adds optional commit userData storage. | |
static const int32_t | FORMAT_DIAGNOSTICS |
This format adds optional per-segment string diagnostics storage, and switches userData to Map. | |
static const int32_t | CURRENT_FORMAT |
This must always point to the most recent file format. | |
Protected Member Functions | |
void | write (const DirectoryPtr &directory) |
![]() | |
LuceneObject () | |
Additional Inherited Members | |
![]() | |
Collection< SegmentInfoPtr > | segmentInfos |
![]() | |
SynchronizePtr | objectLock |
LuceneSignalPtr | objectSignal |
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 | ( | const DirectoryPtr & | dir | ) |
Writes & syncs to the Directory dir, taking care to remove the segments file on exception.
HashSet< String > Lucene::SegmentInfos::files | ( | const 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 | ( | const 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 | ( | const DirectoryPtr & | dir | ) |
SegmentInfoPtr Lucene::SegmentInfos::info | ( | int32_t | i | ) |
|
static |
void Lucene::SegmentInfos::prepareCommit | ( | const 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 | ( | const DirectoryPtr & | directory | ) |
This version of read uses the retry logic (for lock-less commits) to find the right segments file to load.
void Lucene::SegmentInfos::read | ( | const DirectoryPtr & | directory, |
const String & | segmentFileName | ||
) |
Read a particular segmentFileName. Note that this may throw an IOException if a commit is in process.
|
static |
Returns userData from latest segments file.
|
static |
Current version number from segments file.
void Lucene::SegmentInfos::replace | ( | const SegmentInfosPtr & | other | ) |
Replaces all segments in this instance, but keeps generation, version, counter so that future commits remain write once.
void Lucene::SegmentInfos::rollbackCommit | ( | const DirectoryPtr & | dir | ) |
String Lucene::SegmentInfos::segString | ( | const 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 | ( | const 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.