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
IndexReader.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::Collection< IndexReaderPtr >
Lucene::HashSet< String >
Lucene::IndexReader
IndexReader is an abstract class, providing an interface for accessing an index. Search of an index i...
Definition: IndexReader.h:39
Lucene::IndexReader::FieldOption
FieldOption
Constants describing field properties, for example used for IndexReader#getFieldNames(FieldOption).
Definition: IndexReader.h:48
Lucene::ParallelReader
An IndexReader which reads multiple, parallel indexes. Each index added must have the same number of ...
Definition: ParallelReader.h:26
Lucene::ParallelReader::readers
Collection< IndexReaderPtr > readers
Definition: ParallelReader.h:35
Lucene::ParallelReader::add
void add(const IndexReaderPtr &reader)
Add an IndexReader.
Lucene::ParallelReader::norms
virtual ByteArray norms(const String &field)
Returns the byte-encoded normalization factor for the named field of every document.
Lucene::ParallelReader::getTermFreqVector
virtual void getTermFreqVector(int32_t docNumber, const TermVectorMapperPtr &mapper)
Map all the term vectors for all fields in a Document.
Lucene::ParallelReader::fieldToReader
MapStringIndexReader fieldToReader
Definition: ParallelReader.h:41
Lucene::ParallelReader::storedFieldReaders
Collection< IndexReaderPtr > storedFieldReaders
Definition: ParallelReader.h:43
Lucene::ParallelReader::incRefReaders
bool incRefReaders
Definition: ParallelReader.h:40
Lucene::ParallelReader::decrefOnClose
Collection< uint8_t > decrefOnClose
Definition: ParallelReader.h:39
Lucene::ParallelReader::isDeleted
virtual bool isDeleted(int32_t n)
Returns true if document n has been deleted.
Lucene::ParallelReader::terms
virtual TermEnumPtr terms()
Returns an enumeration of all the terms in the index. The enumeration is ordered by Term::compareTo()...
Lucene::ParallelReader::termPositions
virtual TermPositionsPtr termPositions()
Returns an unpositioned TermPositions enumerator.
Lucene::ParallelReader::termDocs
virtual TermDocsPtr termDocs()
Returns an unpositioned TermDocs enumerator.
Lucene::ParallelReader::docFreq
virtual int32_t docFreq(const TermPtr &t)
Returns the number of documents containing the term t.
Lucene::ParallelReader::_numDocs
int32_t _numDocs
Definition: ParallelReader.h:46
Lucene::ParallelReader::doReopen
IndexReaderPtr doReopen(bool doClone)
Lucene::ParallelReader::doCommit
virtual void doCommit(MapStringString commitUserData)
Implements commit.
Lucene::ParallelReader::readerToFields
MapIndexReaderSetString readerToFields
Definition: ParallelReader.h:42
Lucene::ParallelReader::clone
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Efficiently clones the IndexReader (sharing most internal state).
Lucene::ParallelReader::termDocs
virtual TermDocsPtr termDocs(const TermPtr &term)
Returns an enumeration of all the documents which contain term. For each document,...
Lucene::ParallelReader::getTermFreqVector
virtual void getTermFreqVector(int32_t docNumber, const String &field, const TermVectorMapperPtr &mapper)
Load the Term Vector into a user-defined data structure instead of relying on the parallel arrays of ...
Lucene::ParallelReader::ParallelReader
ParallelReader(bool closeSubReaders=true)
Construct a ParallelReader.
Lucene::ParallelReader::getTermFreqVector
virtual TermFreqVectorPtr getTermFreqVector(int32_t docNumber, const String &field)
Return a term frequency vector for the specified document and field.
Lucene::ParallelReader::getTermFreqVectors
virtual Collection< TermFreqVectorPtr > getTermFreqVectors(int32_t docNumber)
Return an array of term frequency vectors for the specified document.
Lucene::ParallelReader::document
virtual DocumentPtr document(int32_t n, const FieldSelectorPtr &fieldSelector)
Get the Document at the n'th position.
Lucene::ParallelReader::hasNorms
virtual bool hasNorms(const String &field)
Returns true if there are norms stored for this field.
Lucene::ParallelReader::getVersion
virtual int64_t getVersion()
Not implemented.
Lucene::ParallelReader::doUndeleteAll
virtual void doUndeleteAll()
Implements actual undeleteAll().
Lucene::ParallelReader::norms
virtual void norms(const String &field, ByteArray norms, int32_t offset)
Reads the byte-encoded normalization factor for the named field of every document.
Lucene::ParallelReader::_maxDoc
int32_t _maxDoc
Definition: ParallelReader.h:45
Lucene::ParallelReader::numDocs
virtual int32_t numDocs()
Returns the number of documents in this index.
Lucene::ParallelReader::isCurrent
virtual bool isCurrent()
Checks recursively if all subreaders are up to date.
Lucene::ParallelReader::termPositions
virtual TermPositionsPtr termPositions(const TermPtr &term)
Returns an enumeration of all the documents which contain term.
Lucene::ParallelReader::doDelete
virtual void doDelete(int32_t docNum)
Implements deletion of the document numbered docNum.
Lucene::ParallelReader::isOptimized
virtual bool isOptimized()
Checks recursively if all subindexes are optimized.
Lucene::ParallelReader::terms
virtual TermEnumPtr terms(const TermPtr &t)
Returns an enumeration of all terms starting at a given term. If the given term does not exist,...
Lucene::ParallelReader::_hasDeletions
bool _hasDeletions
Definition: ParallelReader.h:47
Lucene::ParallelReader::hasDeletions
virtual bool hasDeletions()
Returns true if any documents have been deleted.
Lucene::ParallelReader::getSubReaders
Collection< IndexReaderPtr > getSubReaders()
Lucene::ParallelReader::reopen
virtual IndexReaderPtr reopen()
Tries to reopen the subreaders.
Lucene::ParallelReader::doClose
virtual void doClose()
Implements close.
Lucene::ParallelReader::maxDoc
virtual int32_t maxDoc()
Returns one greater than the largest possible document number. This may be used to,...
Lucene::ParallelReader::~ParallelReader
virtual ~ParallelReader()
Lucene::ParallelReader::doSetNorm
virtual void doSetNorm(int32_t doc, const String &field, uint8_t value)
Implements setNorm in subclass.
Lucene::ParallelReader::add
void add(const IndexReaderPtr &reader, bool ignoreStoredFields)
Add an IndexReader whose stored fields will not be returned. This can accelerate search when stored f...
Lucene::ParallelReader::getFieldNames
virtual HashSet< String > getFieldNames(FieldOption fieldOption)
Get a list of unique field names that exist in this index and have the specified field option informa...
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
Lucene::TermPositionsPtr
boost::shared_ptr< TermPositions > TermPositionsPtr
Definition: LuceneTypes.h:243
Lucene::TermDocsPtr
boost::shared_ptr< TermDocs > TermDocsPtr
Definition: LuceneTypes.h:236
Lucene::FieldSelectorPtr
boost::shared_ptr< FieldSelector > FieldSelectorPtr
Definition: LuceneTypes.h:77
Lucene::TermPtr
boost::shared_ptr< Term > TermPtr
Definition: LuceneTypes.h:233
Lucene::TermVectorMapperPtr
boost::shared_ptr< TermVectorMapper > TermVectorMapperPtr
Definition: LuceneTypes.h:254
Lucene::TermEnumPtr
boost::shared_ptr< TermEnum > TermEnumPtr
Definition: LuceneTypes.h:235
Lucene::IndexReaderPtr
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition: LuceneTypes.h:157
Lucene::TermFreqVectorPtr
boost::shared_ptr< TermFreqVector > TermFreqVectorPtr
Definition: LuceneTypes.h:237
Lucene::DocumentPtr
boost::shared_ptr< Document > DocumentPtr
Definition: LuceneTypes.h:74

clucene.sourceforge.net