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


Loading...
Searching...
No Matches
ParallelReader.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 PARALLELREADER_H
8#define PARALLELREADER_H
9
10#include "IndexReader.h"
11
12namespace Lucene {
13
26class LPPAPI ParallelReader : public IndexReader {
27public:
31 ParallelReader(bool closeSubReaders = true);
32
33 virtual ~ParallelReader();
34
36
37protected:
39 Collection<uint8_t> decrefOnClose; // remember which subreaders to decRef on close
41 MapStringIndexReader fieldToReader;
42 MapIndexReaderSetString readerToFields;
44
45 int32_t _maxDoc;
46 int32_t _numDocs;
48
49public:
51 void add(const IndexReaderPtr& reader);
52
55 void add(const IndexReaderPtr& reader, bool ignoreStoredFields);
56
58
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
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
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
134
137
140
142 virtual bool isCurrent();
143
145 virtual bool isOptimized();
146
148 virtual int64_t getVersion();
149
151
155
156protected:
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
#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
Utility template class to handle hash set collections that can be safely copied and shared.
Definition HashSet.h:17
IndexReader is an abstract class, providing an interface for accessing an index. Search of an index i...
Definition IndexReader.h:39
FieldOption
Constants describing field properties, for example used for IndexReader#getFieldNames(FieldOption).
Definition IndexReader.h:48
An IndexReader which reads multiple, parallel indexes. Each index added must have the same number of ...
Definition ParallelReader.h:26
virtual Collection< TermFreqVectorPtr > getTermFreqVectors(int32_t docNumber)
Return an array of term frequency vectors for the specified document.
Collection< IndexReaderPtr > readers
Definition ParallelReader.h:38
void add(const IndexReaderPtr &reader)
Add an IndexReader.
virtual ByteArray norms(const String &field)
Returns the byte-encoded normalization factor for the named field of every document.
virtual void getTermFreqVector(int32_t docNumber, const TermVectorMapperPtr &mapper)
Map all the term vectors for all fields in a Document.
MapStringIndexReader fieldToReader
Definition ParallelReader.h:41
Collection< IndexReaderPtr > storedFieldReaders
Definition ParallelReader.h:43
bool incRefReaders
Definition ParallelReader.h:40
Collection< uint8_t > decrefOnClose
Definition ParallelReader.h:39
virtual bool isDeleted(int32_t n)
Returns true if document n has been deleted.
virtual TermEnumPtr terms()
Returns an enumeration of all the terms in the index. The enumeration is ordered by Term::compareTo()...
virtual TermPositionsPtr termPositions()
Returns an unpositioned TermPositions enumerator.
virtual TermDocsPtr termDocs()
Returns an unpositioned TermDocs enumerator.
virtual int32_t docFreq(const TermPtr &t)
Returns the number of documents containing the term t.
int32_t _numDocs
Definition ParallelReader.h:46
IndexReaderPtr doReopen(bool doClone)
virtual void doCommit(MapStringString commitUserData)
Implements commit.
MapIndexReaderSetString readerToFields
Definition ParallelReader.h:42
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Efficiently clones the IndexReader (sharing most internal state).
virtual TermDocsPtr termDocs(const TermPtr &term)
Returns an enumeration of all the documents which contain term. For each document,...
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 ...
ParallelReader(bool closeSubReaders=true)
Construct a ParallelReader.
virtual TermFreqVectorPtr getTermFreqVector(int32_t docNumber, const String &field)
Return a term frequency vector for the specified document and field.
virtual DocumentPtr document(int32_t n, const FieldSelectorPtr &fieldSelector)
Get the Document at the n'th position.
virtual bool hasNorms(const String &field)
Returns true if there are norms stored for this field.
virtual int64_t getVersion()
Not implemented.
virtual void doUndeleteAll()
Implements actual undeleteAll().
virtual void norms(const String &field, ByteArray norms, int32_t offset)
Reads the byte-encoded normalization factor for the named field of every document.
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...
int32_t _maxDoc
Definition ParallelReader.h:45
virtual int32_t numDocs()
Returns the number of documents in this index.
virtual bool isCurrent()
Checks recursively if all subreaders are up to date.
virtual TermPositionsPtr termPositions(const TermPtr &term)
Returns an enumeration of all the documents which contain term.
virtual void doDelete(int32_t docNum)
Implements deletion of the document numbered docNum.
virtual bool isOptimized()
Checks recursively if all subindexes are optimized.
virtual TermEnumPtr terms(const TermPtr &t)
Returns an enumeration of all terms starting at a given term. If the given term does not exist,...
bool _hasDeletions
Definition ParallelReader.h:47
virtual bool hasDeletions()
Returns true if any documents have been deleted.
Collection< IndexReaderPtr > getSubReaders()
virtual IndexReaderPtr reopen()
Tries to reopen the subreaders.
virtual void doClose()
Implements close.
virtual int32_t maxDoc()
Returns one greater than the largest possible document number. This may be used to,...
virtual void doSetNorm(int32_t doc, const String &field, uint8_t value)
Implements setNorm in subclass.
void add(const IndexReaderPtr &reader, bool ignoreStoredFields)
Add an IndexReader whose stored fields will not be returned. This can accelerate search when stored f...
Definition AbstractAllTermDocs.h:12
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition LuceneTypes.h:539
boost::shared_ptr< TermPositions > TermPositionsPtr
Definition LuceneTypes.h:243
boost::shared_ptr< TermDocs > TermDocsPtr
Definition LuceneTypes.h:236
boost::shared_ptr< FieldSelector > FieldSelectorPtr
Definition LuceneTypes.h:77
boost::shared_ptr< Term > TermPtr
Definition LuceneTypes.h:233
boost::shared_ptr< TermVectorMapper > TermVectorMapperPtr
Definition LuceneTypes.h:254
boost::shared_ptr< TermEnum > TermEnumPtr
Definition LuceneTypes.h:235
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition LuceneTypes.h:157
boost::shared_ptr< TermFreqVector > TermFreqVectorPtr
Definition LuceneTypes.h:237
boost::shared_ptr< Document > DocumentPtr
Definition LuceneTypes.h:74

clucene.sourceforge.net