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


Loading...
Searching...
No Matches
MultiLevelSkipListReader.h
Go to the documentation of this file.
1
2// Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3// Distributable under the terms of either the Apache License (Version 2.0)
4// or the GNU Lesser General Public License.
6
7#ifndef MULTILEVELSKIPLISTREADER_H
8#define MULTILEVELSKIPLISTREADER_H
9
10#include "IndexInput.h"
11
12namespace Lucene {
13
21public:
22 MultiLevelSkipListReader(const IndexInputPtr& skipStream, int32_t maxSkipLevels, int32_t skipInterval);
24
26
27protected:
30
33
39
40 int32_t docCount;
42
43 Collection<IndexInputPtr> skipStream; // skipStream for each level
44 Collection<int64_t> skipPointer; // the start pointer of each skip level
45 Collection<int32_t> skipInterval; // skipInterval of each level
46 Collection<int32_t> numSkipped; // number of docs skipped per level
47
48 Collection<int32_t> skipDoc; // doc id of current skip entry per level
49 int32_t lastDoc; // doc id of last read skip entry with docId <= target
50 Collection<int64_t> childPointer; // child pointer of current skip entry per level
51 int64_t lastChildPointer; // childPointer of last read skip entry with docId <= target
52
54
55public:
57 virtual int32_t getDoc();
58
61 virtual int32_t skipTo(int32_t target);
62
63 virtual void close();
64
66 virtual void init(int64_t skipPointer, int32_t df);
67
68protected:
69 virtual bool loadNextSkip(int32_t level);
70
72 virtual void seekChild(int32_t level);
73
75 virtual void loadSkipLevels();
76
81 virtual int32_t readSkipData(int32_t level, const IndexInputPtr& skipStream) = 0;
82
84 virtual void setLastSkipData(int32_t level);
85};
86
88class SkipBuffer : public IndexInput {
89public:
90 SkipBuffer(const IndexInputPtr& input, int32_t length);
91 virtual ~SkipBuffer();
92
94
95protected:
96 ByteArray data;
97 int64_t pointer;
98 int32_t pos;
99
100public:
102 virtual void close();
103
105 virtual int64_t getFilePointer();
106
108 virtual int64_t length();
109
111 virtual uint8_t readByte();
112
114 virtual void readBytes(uint8_t* b, int32_t offset, int32_t length);
115
117 virtual void seek(int64_t pos);
118};
119
120}
121
122#endif
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
Abstract base class for input from a file in a Directory. A random-access input stream....
Definition IndexInput.h:17
Base class for all Lucene classes.
Definition LuceneObject.h:31
This abstract class reads skip lists with multiple levels.
Definition MultiLevelSkipListReader.h:20
Collection< int64_t > childPointer
Definition MultiLevelSkipListReader.h:50
Collection< int32_t > numSkipped
Definition MultiLevelSkipListReader.h:46
int32_t lastDoc
Definition MultiLevelSkipListReader.h:49
bool haveSkipped
Definition MultiLevelSkipListReader.h:41
int64_t lastChildPointer
Definition MultiLevelSkipListReader.h:51
MultiLevelSkipListReader(const IndexInputPtr &skipStream, int32_t maxSkipLevels, int32_t skipInterval)
virtual int32_t getDoc()
Returns the id of the doc to which the last call of skipTo(int) has skipped.
virtual int32_t skipTo(int32_t target)
Skips entries to the first beyond the current whose document number is greater than or equal to targe...
virtual void init(int64_t skipPointer, int32_t df)
Initializes the reader.
int32_t maxNumberOfSkipLevels
the maximum number of skip levels possible for this index
Definition MultiLevelSkipListReader.h:29
virtual bool loadNextSkip(int32_t level)
virtual void loadSkipLevels()
Loads the skip levels.
Collection< int64_t > skipPointer
Definition MultiLevelSkipListReader.h:44
virtual void setLastSkipData(int32_t level)
Copies the values of the last read skip entry on this level.
virtual int32_t readSkipData(int32_t level, const IndexInputPtr &skipStream)=0
Subclasses must implement the actual skip data encoding in this method.
int32_t numberOfSkipLevels
number of levels in this skip list
Definition MultiLevelSkipListReader.h:32
Collection< IndexInputPtr > skipStream
Definition MultiLevelSkipListReader.h:43
int32_t docCount
Definition MultiLevelSkipListReader.h:40
virtual void seekChild(int32_t level)
Seeks the skip entry on the given level.
Collection< int32_t > skipInterval
Definition MultiLevelSkipListReader.h:45
Collection< int32_t > skipDoc
Definition MultiLevelSkipListReader.h:48
bool inputIsBuffered
Definition MultiLevelSkipListReader.h:53
int32_t numberOfLevelsToBuffer
Defines the number of top skip levels to buffer in memory. Reducing this number results in less memor...
Definition MultiLevelSkipListReader.h:38
Used to buffer the top skip levels.
Definition MultiLevelSkipListReader.h:88
ByteArray data
Definition MultiLevelSkipListReader.h:96
virtual void close()
Closes the stream to further operations.
int64_t pointer
Definition MultiLevelSkipListReader.h:97
virtual uint8_t readByte()
Reads and returns a single byte.
SkipBuffer(const IndexInputPtr &input, int32_t length)
virtual int64_t getFilePointer()
Returns the current position in this file, where the next read will occur.
virtual ~SkipBuffer()
virtual int64_t length()
The number of bytes in the file.
int32_t pos
Definition MultiLevelSkipListReader.h:98
virtual void seek(int64_t pos)
Sets current position in this file, where the next read will occur.
virtual void readBytes(uint8_t *b, int32_t offset, int32_t length)
Reads a specified number of bytes into an array at the specified offset.
Definition AbstractAllTermDocs.h:12
boost::shared_ptr< IndexInput > IndexInputPtr
Definition LuceneTypes.h:493

clucene.sourceforge.net