Lucene++ - a full-featured, c++ search engine
API Documentation


Loading...
Searching...
No Matches
Lucene::SegmentInfo Class Reference

Information about a segment such as it's name, directory, and files related to the segment. More...

#include <SegmentInfo.h>

Inheritance diagram for Lucene::SegmentInfo:

Public Member Functions

 SegmentInfo (const String &name, int32_t docCount, const DirectoryPtr &dir)
 SegmentInfo (const String &name, int32_t docCount, const DirectoryPtr &dir, bool isCompoundFile, bool hasSingleNormFile)
 SegmentInfo (const String &name, int32_t docCount, const DirectoryPtr &dir, bool isCompoundFile, bool hasSingleNormFile, int32_t docStoreOffset, const String &docStoreSegment, bool docStoreIsCompoundFile, bool hasProx)
 SegmentInfo (const DirectoryPtr &dir, int32_t format, const IndexInputPtr &input)
 Construct a new SegmentInfo instance by reading a previously saved SegmentInfo from input.
virtual ~SegmentInfo ()
virtual String getClassName ()
boost::shared_ptr< SegmentInfoshared_from_this ()
void reset (const SegmentInfoPtr &src)
 Copy everything from src SegmentInfo into our instance.
void setDiagnostics (MapStringString diagnostics)
MapStringString getDiagnostics ()
void setNumFields (int32_t numFields)
int64_t sizeInBytes ()
 Returns total size in bytes of all of files used by this segment.
bool hasDeletions ()
void advanceDelGen ()
void clearDelGen ()
virtual LuceneObjectPtr clone (const LuceneObjectPtr &other=LuceneObjectPtr())
 Return clone of this object.
String getDelFileName ()
bool hasSeparateNorms (int32_t fieldNumber)
 Returns true if this field for this segment has saved a separate norms file (_<segment>_N.sX).
bool hasSeparateNorms ()
 Returns true if any fields in this segment have separate norms.
void advanceNormGen (int32_t fieldIndex)
 Increment the generation count for the norms file for this field.
String getNormFileName (int32_t number)
 Get the file name for the norms file for this field.
void setUseCompoundFile (bool isCompoundFile)
 Mark whether this segment is stored as a compound file.
bool getUseCompoundFile ()
 Returns true if this segment is stored as a compound file; else, false.
int32_t getDelCount ()
void setDelCount (int32_t delCount)
int32_t getDocStoreOffset ()
bool getDocStoreIsCompoundFile ()
void setDocStoreIsCompoundFile (bool v)
String getDocStoreSegment ()
void setDocStoreOffset (int32_t offset)
void setDocStore (int32_t offset, const String &segment, bool isCompoundFile)
void write (const IndexOutputPtr &output)
 Save this segment's info.
void setHasProx (bool hasProx)
bool getHasProx ()
HashSet< String > files ()
 Return all files referenced by this SegmentInfo. The returns List is a locally cached List so you should not modify it.
String segString (const DirectoryPtr &dir)
 Used for debugging.
virtual bool equals (const LuceneObjectPtr &other)
 We consider another SegmentInfo instance equal if it has the same dir and same name.
virtual int32_t hashCode ()
 Return hash code for this object.
Public Member Functions inherited from Lucene::LuceneObject
virtual ~LuceneObject ()
virtual void initialize ()
 Called directly after instantiation to create objects that depend on this object being fully constructed.
virtual int32_t compareTo (const LuceneObjectPtr &other)
 Compare two objects.
virtual String toString ()
 Returns a string representation of the object.
Public Member Functions inherited from Lucene::LuceneSync
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 ()

Data Fields

String name
int32_t docCount
DirectoryPtr dir

Static Public Attributes

static const int32_t NO
static const int32_t YES
static const int32_t CHECK_DIR
static const int32_t WITHOUT_GEN

Protected Member Functions

void addIfExists (HashSet< String > files, const String &fileName)
void clearFiles ()
 Called whenever any change is made that affects which files this segment has.
Protected Member Functions inherited from Lucene::LuceneObject
 LuceneObject ()

Protected Attributes

bool preLockless
int64_t delGen
Collection< int64_t > normGen
uint8_t isCompoundFile
bool hasSingleNormFile
HashSet< String > _files
int64_t _sizeInBytes
int32_t docStoreOffset
String docStoreSegment
bool docStoreIsCompoundFile
int32_t delCount
bool hasProx
MapStringString diagnostics
Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr objectLock
LuceneSignalPtr objectSignal

Detailed Description

Information about a segment such as it's name, directory, and files related to the segment.

Constructor & Destructor Documentation

◆ SegmentInfo() [1/4]

Lucene::SegmentInfo::SegmentInfo ( const String & name,
int32_t docCount,
const DirectoryPtr & dir )

References dir, docCount, and name.

Referenced by _getClassName().

◆ SegmentInfo() [2/4]

Lucene::SegmentInfo::SegmentInfo ( const String & name,
int32_t docCount,
const DirectoryPtr & dir,
bool isCompoundFile,
bool hasSingleNormFile )

◆ SegmentInfo() [3/4]

Lucene::SegmentInfo::SegmentInfo ( const String & name,
int32_t docCount,
const DirectoryPtr & dir,
bool isCompoundFile,
bool hasSingleNormFile,
int32_t docStoreOffset,
const String & docStoreSegment,
bool docStoreIsCompoundFile,
bool hasProx )

◆ SegmentInfo() [4/4]

Lucene::SegmentInfo::SegmentInfo ( const DirectoryPtr & dir,
int32_t format,
const IndexInputPtr & input )

Construct a new SegmentInfo instance by reading a previously saved SegmentInfo from input.

Parameters
dirdirectory to load from.
formatformat of the segments info file.
inputinput handle to read segment info from.

References dir.

◆ ~SegmentInfo()

virtual Lucene::SegmentInfo::~SegmentInfo ( )
virtual

Member Function Documentation

◆ _getClassName()

String Lucene::SegmentInfo::_getClassName ( )
inlinestatic

References SegmentInfo().

◆ addIfExists()

void Lucene::SegmentInfo::addIfExists ( HashSet< String > files,
const String & fileName )
protected

References files().

◆ advanceDelGen()

void Lucene::SegmentInfo::advanceDelGen ( )

◆ advanceNormGen()

void Lucene::SegmentInfo::advanceNormGen ( int32_t fieldIndex)

Increment the generation count for the norms file for this field.

Parameters
fieldIndexfield whose norm file will be rewritten

◆ clearDelGen()

void Lucene::SegmentInfo::clearDelGen ( )

◆ clearFiles()

void Lucene::SegmentInfo::clearFiles ( )
protected

Called whenever any change is made that affects which files this segment has.

◆ clone()

virtual LuceneObjectPtr Lucene::SegmentInfo::clone ( const LuceneObjectPtr & other = LuceneObjectPtr())
virtual

Return clone of this object.

Parameters
otherclone reference - null when called initially, then set in top virtual override.

Reimplemented from Lucene::LuceneObject.

◆ equals()

virtual bool Lucene::SegmentInfo::equals ( const LuceneObjectPtr & other)
virtual

We consider another SegmentInfo instance equal if it has the same dir and same name.

Reimplemented from Lucene::LuceneObject.

◆ files()

HashSet< String > Lucene::SegmentInfo::files ( )

Return all files referenced by this SegmentInfo. The returns List is a locally cached List so you should not modify it.

Referenced by addIfExists().

◆ getClassName()

virtual String Lucene::SegmentInfo::getClassName ( )
inlinevirtual

◆ getDelCount()

int32_t Lucene::SegmentInfo::getDelCount ( )

◆ getDelFileName()

String Lucene::SegmentInfo::getDelFileName ( )

◆ getDiagnostics()

MapStringString Lucene::SegmentInfo::getDiagnostics ( )

◆ getDocStoreIsCompoundFile()

bool Lucene::SegmentInfo::getDocStoreIsCompoundFile ( )

◆ getDocStoreOffset()

int32_t Lucene::SegmentInfo::getDocStoreOffset ( )

◆ getDocStoreSegment()

String Lucene::SegmentInfo::getDocStoreSegment ( )

◆ getHasProx()

bool Lucene::SegmentInfo::getHasProx ( )

◆ getNormFileName()

String Lucene::SegmentInfo::getNormFileName ( int32_t number)

Get the file name for the norms file for this field.

Parameters
numberfield index

◆ getUseCompoundFile()

bool Lucene::SegmentInfo::getUseCompoundFile ( )

Returns true if this segment is stored as a compound file; else, false.

◆ hasDeletions()

bool Lucene::SegmentInfo::hasDeletions ( )

◆ hashCode()

virtual int32_t Lucene::SegmentInfo::hashCode ( )
virtual

Return hash code for this object.

Reimplemented from Lucene::LuceneObject.

◆ hasSeparateNorms() [1/2]

bool Lucene::SegmentInfo::hasSeparateNorms ( )

Returns true if any fields in this segment have separate norms.

◆ hasSeparateNorms() [2/2]

bool Lucene::SegmentInfo::hasSeparateNorms ( int32_t fieldNumber)

Returns true if this field for this segment has saved a separate norms file (_<segment>_N.sX).

Parameters
fieldNumberthe field index to check

◆ reset()

void Lucene::SegmentInfo::reset ( const SegmentInfoPtr & src)

Copy everything from src SegmentInfo into our instance.

◆ segString()

String Lucene::SegmentInfo::segString ( const DirectoryPtr & dir)

Used for debugging.

References dir.

◆ setDelCount()

void Lucene::SegmentInfo::setDelCount ( int32_t delCount)

References delCount.

◆ setDiagnostics()

void Lucene::SegmentInfo::setDiagnostics ( MapStringString diagnostics)

References diagnostics.

◆ setDocStore()

void Lucene::SegmentInfo::setDocStore ( int32_t offset,
const String & segment,
bool isCompoundFile )

References isCompoundFile.

◆ setDocStoreIsCompoundFile()

void Lucene::SegmentInfo::setDocStoreIsCompoundFile ( bool v)

◆ setDocStoreOffset()

void Lucene::SegmentInfo::setDocStoreOffset ( int32_t offset)

◆ setHasProx()

void Lucene::SegmentInfo::setHasProx ( bool hasProx)

References hasProx.

◆ setNumFields()

void Lucene::SegmentInfo::setNumFields ( int32_t numFields)

◆ setUseCompoundFile()

void Lucene::SegmentInfo::setUseCompoundFile ( bool isCompoundFile)

Mark whether this segment is stored as a compound file.

Parameters
isCompoundFiletrue if this is a compound file; else, false

References isCompoundFile.

◆ shared_from_this()

boost::shared_ptr< SegmentInfo > Lucene::SegmentInfo::shared_from_this ( )
inline

◆ sizeInBytes()

int64_t Lucene::SegmentInfo::sizeInBytes ( )

Returns total size in bytes of all of files used by this segment.

◆ write()

void Lucene::SegmentInfo::write ( const IndexOutputPtr & output)

Save this segment's info.

Field Documentation

◆ _files

HashSet<String> Lucene::SegmentInfo::_files
protected

◆ _sizeInBytes

int64_t Lucene::SegmentInfo::_sizeInBytes
protected

◆ CHECK_DIR

const int32_t Lucene::SegmentInfo::CHECK_DIR
static

◆ delCount

int32_t Lucene::SegmentInfo::delCount
protected

Referenced by setDelCount().

◆ delGen

int64_t Lucene::SegmentInfo::delGen
protected

◆ diagnostics

MapStringString Lucene::SegmentInfo::diagnostics
protected

Referenced by setDiagnostics().

◆ dir

DirectoryPtr Lucene::SegmentInfo::dir

◆ docCount

int32_t Lucene::SegmentInfo::docCount

◆ docStoreIsCompoundFile

bool Lucene::SegmentInfo::docStoreIsCompoundFile
protected

Referenced by SegmentInfo().

◆ docStoreOffset

int32_t Lucene::SegmentInfo::docStoreOffset
protected

Referenced by SegmentInfo().

◆ docStoreSegment

String Lucene::SegmentInfo::docStoreSegment
protected

Referenced by SegmentInfo().

◆ hasProx

bool Lucene::SegmentInfo::hasProx
protected

Referenced by SegmentInfo(), and setHasProx().

◆ hasSingleNormFile

bool Lucene::SegmentInfo::hasSingleNormFile
protected

Referenced by SegmentInfo(), and SegmentInfo().

◆ isCompoundFile

uint8_t Lucene::SegmentInfo::isCompoundFile
protected

◆ name

String Lucene::SegmentInfo::name

◆ NO

const int32_t Lucene::SegmentInfo::NO
static

◆ normGen

Collection<int64_t> Lucene::SegmentInfo::normGen
protected

◆ preLockless

bool Lucene::SegmentInfo::preLockless
protected

◆ WITHOUT_GEN

const int32_t Lucene::SegmentInfo::WITHOUT_GEN
static

◆ YES

const int32_t Lucene::SegmentInfo::YES
static

The documentation for this class was generated from the following file:

clucene.sourceforge.net