Lucene++ - a full-featured, c++ search engine
API Documentation
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 |
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