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


Loading...
Searching...
No Matches
MultiReader.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 MULTIREADER_H
8#define MULTIREADER_H
9
10#include "IndexReader.h"
11
12namespace Lucene {
13
15class LPPAPI MultiReader : public IndexReader {
16public:
21 MultiReader(Collection<IndexReaderPtr> subReaders, bool closeSubReaders = true);
22
23 virtual ~MultiReader();
24
26
27protected:
29 Collection<int32_t> starts; // 1st docno for each segment
30 Collection<uint8_t> decrefOnClose; // remember which subreaders to decRef on close
31 MapStringByteArray normsCache;
32 int32_t _maxDoc;
33 int32_t _numDocs;
35
36public:
49
55
57 virtual TermFreqVectorPtr getTermFreqVector(int32_t docNumber, const String& field);
58 virtual void getTermFreqVector(int32_t docNumber, const String& field, const TermVectorMapperPtr& mapper);
59 virtual void getTermFreqVector(int32_t docNumber, const TermVectorMapperPtr& mapper);
60
61 virtual bool isOptimized();
62
64 virtual int32_t numDocs();
65
67 virtual int32_t maxDoc();
68
71 virtual DocumentPtr document(int32_t n, const FieldSelectorPtr& fieldSelector);
72
74 virtual bool isDeleted(int32_t n);
75
77 virtual bool hasDeletions();
78
80 virtual bool hasNorms(const String& field);
81
83 virtual ByteArray norms(const String& field);
84
86 virtual void norms(const String& field, ByteArray norms, int32_t offset);
87
89 virtual TermEnumPtr terms();
90
92 virtual TermEnumPtr terms(const TermPtr& t);
93
95 virtual int32_t docFreq(const TermPtr& t);
96
99
102
106
108 virtual bool isCurrent();
109
111 virtual int64_t getVersion();
112
115
116protected:
121
123 virtual void doDelete(int32_t docNum);
124
126 virtual void doUndeleteAll();
127
129 int32_t readerIndex(int32_t n);
130
132 virtual void doSetNorm(int32_t doc, const String& field, uint8_t value);
133
134 virtual void doCommit(MapStringString commitUserData);
135
137 virtual void doClose();
138};
139
140}
141
142#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 indexes, appending their content.
Definition MultiReader.h:15
virtual bool hasNorms(const String &field)
Returns true if there are norms stored for this field.
int32_t _numDocs
Definition MultiReader.h:33
Collection< uint8_t > decrefOnClose
Definition MultiReader.h:30
virtual bool isOptimized()
Checks is the index is optimized (if it has a single segment and no deletions). Not implemented in th...
MultiReader(Collection< IndexReaderPtr > subReaders, bool closeSubReaders=true)
Construct a MultiReader aggregating the named set of (sub)readers. Directory locking for delete,...
virtual int32_t docFreq(const TermPtr &t)
Returns the number of documents containing the term t.
virtual void doUndeleteAll()
Implements actual undeleteAll() in subclass.
Collection< int32_t > starts
Definition MultiReader.h:29
virtual void doCommit(MapStringString commitUserData)
Implements commit.
virtual void getTermFreqVector(int32_t docNumber, const TermVectorMapperPtr &mapper)
Map all the term vectors for all fields in a Document.
virtual void doSetNorm(int32_t doc, const String &field, uint8_t value)
Implements setNorm in subclass.
virtual ByteArray norms(const String &field)
Returns the byte-encoded normalization factor for the named field of every document.
virtual ~MultiReader()
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 LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Clones the subreaders. (see IndexReader#clone()).
virtual bool isCurrent()
Checks recursively if all subreaders are up to date.
IndexReaderPtr doReopen(bool doClone)
If clone is true then we clone each of the subreaders.
bool _hasDeletions
Definition MultiReader.h:34
virtual bool hasDeletions()
Returns true if any documents have been deleted.
virtual TermFreqVectorPtr getTermFreqVector(int32_t docNumber, const String &field)
Return a term frequency vector for the specified document and field. The returned vector contains ter...
virtual Collection< TermFreqVectorPtr > getTermFreqVectors(int32_t docNumber)
Return an array of term frequency vectors for the specified document. The array contains a vector for...
virtual TermEnumPtr terms(const TermPtr &t)
Returns an enumeration of all terms starting at a given term.
virtual void doDelete(int32_t docNum)
Implements deletion of the document numbered docNum.
virtual TermEnumPtr terms()
Returns an enumeration of all the terms in the index.
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...
virtual int64_t getVersion()
Not implemented.
virtual TermDocsPtr termDocs()
Returns an unpositioned TermDocs enumerator.
virtual int32_t numDocs()
Returns the number of documents in this index.
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.
MapStringByteArray normsCache
Definition MultiReader.h:31
virtual Collection< IndexReaderPtr > getSequentialSubReaders()
Returns the sequential sub readers that this reader is logically composed of.
int32_t _maxDoc
Definition MultiReader.h:32
int32_t readerIndex(int32_t n)
Find reader for doc n.
virtual TermPositionsPtr termPositions()
Returns an unpositioned TermPositions enumerator.
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 ...
virtual bool isDeleted(int32_t n)
Returns true if document n has been deleted.
Collection< IndexReaderPtr > subReaders
Definition MultiReader.h:28
virtual DocumentPtr document(int32_t n, const FieldSelectorPtr &fieldSelector)
Get the Document at the n'th position. The FieldSelector may be used to determine what Fields to load...
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