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

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 (const 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 (const LuceneObjectPtr &other=LuceneObjectPtr())
| Return clone of this object. More...
virtual int32_t | hashCode ()
| Return hash code for this object. More...
virtual bool | equals (const LuceneObjectPtr &other)
| Return whether two objects are equal. More...
virtual int32_t | compareTo (const 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, const 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< RAMOutputStreamPtr > | skipBuffer
| for every skip level a different buffer is used More...
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 | ( |  | ) |

inline static

## ◆ 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

  df | the current document frequency

## ◆ getClassName()

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

inline virtual

Reimplemented in Lucene::DefaultSkipListWriter.

## ◆ init()

void Lucene::MultiLevelSkipListWriter::init | ( |  | ) |

protected

## ◆ resetSkip()

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

protected virtual

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

  output | the 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
| ) |  |

protected pure virtual

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

Parameters

  level | the level skip data shall be writing for
  skipBuffer | the 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:

- MultiLevelSkipListWriter.h

clucene.sourceforge.net