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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
Lucene::MultiLevelSkipListWriter Class Referenceabstract

This abstract class writes skip lists with multiple levels. More...

#include <MultiLevelSkipListWriter.h>

+ Inheritance diagram for Lucene::MultiLevelSkipListWriter:

Public Member Functions

 MultiLevelSkipListWriter (int32_t skipInterval, int32_t maxSkipLevels, int32_t df)
 
virtual ~MultiLevelSkipListWriter ()
 
virtual String getClassName ()
 
boost::shared_ptr
< MultiLevelSkipListWriter
shared_from_this ()
 
void bufferSkip (int32_t df)
 Writes the current skip data to the buffers. The current document frequency determines the max level is skip data is to be written to. More...
 
int64_t writeSkip (IndexOutputPtr output)
 Writes the buffered skip lists to the given output. More...
 
- 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. More...
 
virtual LuceneObjectPtr clone (LuceneObjectPtr other=LuceneObjectPtr())
 Return clone of this object. 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...
 
- Public Member Functions inherited from Lucene::LuceneSync
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 ()
 

Protected Member Functions

void init ()
 
virtual void resetSkip ()
 
virtual void writeSkipData (int32_t level, IndexOutputPtr skipBuffer)=0
 Subclasses must implement the actual skip data encoding in this method. More...
 
- Protected Member Functions inherited from Lucene::LuceneObject
 LuceneObject ()
 

Protected Attributes

int32_t numberOfSkipLevels
 number of levels in this skip list More...
 
int32_t skipInterval
 the skip interval in the list with level = 0 More...
 
Collection< RAMOutputStreamPtrskipBuffer
 for every skip level a different buffer is used More...
 

Detailed Description

This abstract class writes skip lists with multiple levels.

Example for skipInterval = 3:

                                                c            (skip level 2)
            c                 c                 c            (skip level 1) 
x     x     x     x     x     x     x     x     x     x      (skip level 0)

d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d (posting list) 3 6 9 12 15 18 21 24 27 30 (df)

d - document x - skip data c - skip data with child pointer

Skip level i contains every skipInterval-th entry from skip level i-1. Therefore the number of entries on level i is: floor(df / ((skipInterval ^ (i + 1))).

Each skip entry on a level i>0 contains a pointer to the corresponding skip entry in list i-1. This guarantees a logarithmic amount of skips to find the target document.

While this class takes care of writing the different skip levels, subclasses must define the actual format of the skip data.

Constructor & Destructor Documentation

Lucene::MultiLevelSkipListWriter::MultiLevelSkipListWriter ( int32_t  skipInterval,
int32_t  maxSkipLevels,
int32_t  df 
)
virtual Lucene::MultiLevelSkipListWriter::~MultiLevelSkipListWriter ( )
virtual

Member Function Documentation

static String Lucene::MultiLevelSkipListWriter::_getClassName ( )
inlinestatic
void Lucene::MultiLevelSkipListWriter::bufferSkip ( int32_t  df)

Writes the current skip data to the buffers. The current document frequency determines the max level is skip data is to be written to.

Parameters
dfthe current document frequency
virtual String Lucene::MultiLevelSkipListWriter::getClassName ( )
inlinevirtual

Reimplemented in Lucene::DefaultSkipListWriter.

void Lucene::MultiLevelSkipListWriter::init ( )
protected
virtual void Lucene::MultiLevelSkipListWriter::resetSkip ( )
protectedvirtual

Reimplemented in Lucene::DefaultSkipListWriter.

boost::shared_ptr< MultiLevelSkipListWriter > Lucene::MultiLevelSkipListWriter::shared_from_this ( )
inline
int64_t Lucene::MultiLevelSkipListWriter::writeSkip ( IndexOutputPtr  output)

Writes the buffered skip lists to the given output.

Parameters
outputthe IndexOutput the skip lists shall be written to
Returns
the pointer the skip list starts
virtual void Lucene::MultiLevelSkipListWriter::writeSkipData ( int32_t  level,
IndexOutputPtr  skipBuffer 
)
protectedpure virtual

Subclasses must implement the actual skip data encoding in this method.

Parameters
levelthe level skip data shall be writing for
skipBufferthe skip buffer to write to

Implemented in Lucene::DefaultSkipListWriter.

Field Documentation

int32_t Lucene::MultiLevelSkipListWriter::numberOfSkipLevels
protected

number of levels in this skip list

Collection<RAMOutputStreamPtr> Lucene::MultiLevelSkipListWriter::skipBuffer
protected

for every skip level a different buffer is used

int32_t Lucene::MultiLevelSkipListWriter::skipInterval
protected

the skip interval in the list with level = 0


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

clucene.sourceforge.net