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

ParallelReader.h
Go to the documentation of this file.
1 // 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 PARALLELREADER_H
8 #define PARALLELREADER_H
9
10 #include "IndexReader.h"
11
12 namespace Lucene {
13
26 class LPPAPI ParallelReader : public IndexReader {
27 public:
31 ParallelReader(bool closeSubReaders = true);
32
33 virtual ~ParallelReader();
34
35 LUCENE_CLASS(ParallelReader);
36
37 protected:
38 Collection<IndexReaderPtr> readers;
39 Collection<uint8_t> decrefOnClose; // remember which subreaders to decRef on close
40 bool incRefReaders;
41 MapStringIndexReader fieldToReader;
42 MapIndexReaderSetString readerToFields;
43 Collection<IndexReaderPtr> storedFieldReaders;
44
45 int32_t _maxDoc;
46 int32_t _numDocs;
47 bool _hasDeletions;
48
49 public:
51 void add(const IndexReaderPtr& reader);
52
55 void add(const IndexReaderPtr& reader, bool ignoreStoredFields);
56
57 virtual LuceneObjectPtr clone(const LuceneObjectPtr& other = LuceneObjectPtr());
58
70 virtual IndexReaderPtr reopen();
71
73 virtual int32_t numDocs();
74
77 virtual int32_t maxDoc();
78
80 virtual bool hasDeletions();
81
83 virtual bool isDeleted(int32_t n);
84
86 virtual DocumentPtr document(int32_t n, const FieldSelectorPtr& fieldSelector);
87
89 virtual Collection<TermFreqVectorPtr> getTermFreqVectors(int32_t docNumber);
90
92 virtual TermFreqVectorPtr getTermFreqVector(int32_t docNumber, const String& field);
93
96 virtual void getTermFreqVector(int32_t docNumber, const String& field, const TermVectorMapperPtr& mapper);
97
99 virtual void getTermFreqVector(int32_t docNumber, const TermVectorMapperPtr& mapper);
100
102 virtual bool hasNorms(const String& field);
103
105 virtual ByteArray norms(const String& field);
106
108 virtual void norms(const String& field, ByteArray norms, int32_t offset);
109
114 virtual TermEnumPtr terms();
115
120 virtual TermEnumPtr terms(const TermPtr& t);
121
123 virtual int32_t docFreq(const TermPtr& t);
124
130 virtual TermDocsPtr termDocs(const TermPtr& term);
131
133 virtual TermDocsPtr termDocs();
134
136 virtual TermPositionsPtr termPositions(const TermPtr& term);
137
139 virtual TermPositionsPtr termPositions();
140
142 virtual bool isCurrent();
143
145 virtual bool isOptimized();
146
148 virtual int64_t getVersion();
149
150 Collection<IndexReaderPtr> getSubReaders();
151
154 virtual HashSet<String> getFieldNames(FieldOption fieldOption);
155
156 protected:
157 IndexReaderPtr doReopen(bool doClone);
158
160 virtual void doDelete(int32_t docNum);
161
163 virtual void doUndeleteAll();
164
166 virtual void doSetNorm(int32_t doc, const String& field, uint8_t value);
167
169 virtual void doCommit(MapStringString commitUserData);
170
172 virtual void doClose();
173
174 friend class ParallelTermEnum;
175 friend class ParallelTermDocs;
176 friend class ParallelTermPositions;
177 };
178
179 }
180
181 #endif
Lucene::TermPtr
boost::shared_ptr< Term > TermPtr
Definition: LuceneTypes.h:233
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
Lucene::TermDocsPtr
boost::shared_ptr< TermDocs > TermDocsPtr
Definition: LuceneTypes.h:236
Lucene::TermEnumPtr
boost::shared_ptr< TermEnum > TermEnumPtr
Definition: LuceneTypes.h:235
Lucene::ParallelReader::readerToFields
MapIndexReaderSetString readerToFields
Definition: ParallelReader.h:42
Lucene::FieldSelectorPtr
boost::shared_ptr< FieldSelector > FieldSelectorPtr
Definition: LuceneTypes.h:77
Lucene::ParallelReader::decrefOnClose
Collection< uint8_t > decrefOnClose
Definition: ParallelReader.h:39
Lucene::ParallelReader::_hasDeletions
bool _hasDeletions
Definition: ParallelReader.h:47
Lucene::ParallelReader::_maxDoc
int32_t _maxDoc
Definition: ParallelReader.h:45
IndexReader.h
Lucene::DocumentPtr
boost::shared_ptr< Document > DocumentPtr
Definition: LuceneTypes.h:74
Lucene::HashSet< String >
Lucene::IndexReader::FieldOption
FieldOption
Constants describing field properties, for example used for IndexReader#getFieldNames(FieldOption).
Definition: IndexReader.h:48
Lucene::ParallelReader::storedFieldReaders
Collection< IndexReaderPtr > storedFieldReaders
Definition: ParallelReader.h:43
Lucene::IndexReaderPtr
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition: LuceneTypes.h:157
Lucene::TermVectorMapperPtr
boost::shared_ptr< TermVectorMapper > TermVectorMapperPtr
Definition: LuceneTypes.h:254
Lucene::TermPositionsPtr
boost::shared_ptr< TermPositions > TermPositionsPtr
Definition: LuceneTypes.h:243
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::ParallelReader::incRefReaders
bool incRefReaders
Definition: ParallelReader.h:40
Lucene::ParallelReader::fieldToReader
MapStringIndexReader fieldToReader
Definition: ParallelReader.h:41
Lucene::ParallelReader::_numDocs
int32_t _numDocs
Definition: ParallelReader.h:46
Lucene::Collection< IndexReaderPtr >
Lucene::ParallelReader
An IndexReader which reads multiple, parallel indexes. Each index added must have the same number of ...
Definition: ParallelReader.h:26
Lucene::IndexReader
IndexReader is an abstract class, providing an interface for accessing an index. Search of an index i...
Definition: IndexReader.h:39
Lucene::TermFreqVectorPtr
boost::shared_ptr< TermFreqVector > TermFreqVectorPtr
Definition: LuceneTypes.h:237

clucene.sourceforge.net