Lucene++ - a full-featured, c++ search engine
API Documentation
This abstract class writes skip lists with multiple levels. More...
#include <MultiLevelSkipListWriter.h>
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. | |
int64_t | writeSkip (const IndexOutputPtr &output) |
Writes the buffered skip lists to the given output. | |
![]() | |
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. | |
![]() | |
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. | |
![]() | |
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< RAMOutputStreamPtr > | skipBuffer |
for every skip level a different buffer is used | |
![]() | |
SynchronizePtr | objectLock |
LuceneSignalPtr | objectSignal |
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.
Lucene::MultiLevelSkipListWriter::MultiLevelSkipListWriter | ( | int32_t | skipInterval, |
int32_t | maxSkipLevels, | ||
int32_t | df | ||
) |
|
virtual |
|
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.
df | the current document frequency |
|
inlinevirtual |
Reimplemented in Lucene::DefaultSkipListWriter.
|
protected |
|
protectedvirtual |
Reimplemented in Lucene::DefaultSkipListWriter.
|
inline |
int64_t Lucene::MultiLevelSkipListWriter::writeSkip | ( | const IndexOutputPtr & | output | ) |
Writes the buffered skip lists to the given output.
output | the IndexOutput the skip lists shall be written to |
|
protectedpure virtual |
Subclasses must implement the actual skip data encoding in this method.
level | the level skip data shall be writing for |
skipBuffer | the skip buffer to write to |
Implemented in Lucene::DefaultSkipListWriter.
|
protected |
number of levels in this skip list
|
protected |
for every skip level a different buffer is used
|
protected |
the skip interval in the list with level = 0