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


Loading...
Searching...
No Matches
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< MultiLevelSkipListWritershared_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.
 
int64_t writeSkip (const IndexOutputPtr &output)
 Writes the buffered skip lists to the given output.
 
- 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 LuceneObjectPtr clone (const LuceneObjectPtr &other=LuceneObjectPtr())
 Return clone of this object.
 
virtual int32_t hashCode ()
 Return hash code for this object.
 
virtual bool equals (const LuceneObjectPtr &other)
 Return whether two objects are equal.
 
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 ()
 

Protected Member Functions

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

Protected Attributes

int32_t numberOfSkipLevels
 number of levels in this skip list
 
int32_t skipInterval
 the skip interval in the list with level = 0
 
Collection< RAMOutputStreamPtrskipBuffer
 for every skip level a different buffer is used
 
- Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr objectLock
 
LuceneSignalPtr objectSignal
 

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

◆ MultiLevelSkipListWriter()

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

◆ ~MultiLevelSkipListWriter()

virtual Lucene::MultiLevelSkipListWriter::~MultiLevelSkipListWriter ( )
virtual

Member Function Documentation

◆ _getClassName()

static String Lucene::MultiLevelSkipListWriter::_getClassName ( )
inlinestatic

◆ bufferSkip()

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

◆ getClassName()

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

Reimplemented in Lucene::DefaultSkipListWriter.

◆ init()

void Lucene::MultiLevelSkipListWriter::init ( )
protected

◆ resetSkip()

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

Reimplemented in Lucene::DefaultSkipListWriter.

◆ shared_from_this()

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

◆ writeSkip()

int64_t Lucene::MultiLevelSkipListWriter::writeSkip ( const 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

◆ writeSkipData()

virtual void Lucene::MultiLevelSkipListWriter::writeSkipData ( int32_t  level,
const 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

◆ numberOfSkipLevels

int32_t Lucene::MultiLevelSkipListWriter::numberOfSkipLevels
protected

number of levels in this skip list

◆ skipBuffer

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

for every skip level a different buffer is used

◆ skipInterval

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