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
12 namespace Lucene {
13
15 class LPPAPI MultiReader : public IndexReader {
16 public:
21 MultiReader(Collection<IndexReaderPtr> subReaders, bool closeSubReaders = true);
22
23 virtual ~MultiReader();
24
25 LUCENE_CLASS(MultiReader);
26
27 protected:
28 Collection<IndexReaderPtr> subReaders;
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;
34 bool _hasDeletions;
35
36 public:
48 virtual IndexReaderPtr reopen();
49
54 virtual LuceneObjectPtr clone(const LuceneObjectPtr& other = LuceneObjectPtr());
55
56 virtual Collection<TermFreqVectorPtr> getTermFreqVectors(int32_t docNumber);
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
98 virtual TermDocsPtr termDocs();
99
101 virtual TermPositionsPtr termPositions();
102
105 virtual HashSet<String> getFieldNames(FieldOption fieldOption);
106
108 virtual bool isCurrent();
109
111 virtual int64_t getVersion();
112
114 virtual Collection<IndexReaderPtr> getSequentialSubReaders();
115
116 protected:
120 IndexReaderPtr doReopen(bool doClone);
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
IndexReader.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Lucene::Collection
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
Lucene::HashSet
Utility template class to handle hash set collections that can be safely copied and shared.
Definition HashSet.h:17
Lucene::IndexReader::IndexReader
IndexReader()
Lucene::IndexReader::FieldOption
FieldOption
Constants describing field properties, for example used for IndexReader#getFieldNames(FieldOption).
Definition IndexReader.h:48
Lucene::MultiReader::hasNorms
virtual bool hasNorms(const String &field)
Returns true if there are norms stored for this field.
Lucene::MultiReader::_numDocs
int32_t _numDocs
Definition MultiReader.h:33
Lucene::MultiReader::decrefOnClose
Collection< uint8_t > decrefOnClose
Definition MultiReader.h:30
Lucene::MultiReader::isOptimized
virtual bool isOptimized()
Checks is the index is optimized (if it has a single segment and no deletions). Not implemented in th...
Lucene::MultiReader::MultiReader
MultiReader(Collection< IndexReaderPtr > subReaders, bool closeSubReaders=true)
Construct a MultiReader aggregating the named set of (sub)readers. Directory locking for delete,...
Lucene::MultiReader::docFreq
virtual int32_t docFreq(const TermPtr &t)
Returns the number of documents containing the term t.
Lucene::MultiReader::doUndeleteAll
virtual void doUndeleteAll()
Implements actual undeleteAll() in subclass.
Lucene::MultiReader::starts
Collection< int32_t > starts
Definition MultiReader.h:29
Lucene::MultiReader::doCommit
virtual void doCommit(MapStringString commitUserData)
Implements commit.
Lucene::MultiReader::getTermFreqVector
virtual void getTermFreqVector(int32_t docNumber, const TermVectorMapperPtr &mapper)
Map all the term vectors for all fields in a Document.
Lucene::MultiReader::doSetNorm
virtual void doSetNorm(int32_t doc, const String &field, uint8_t value)
Implements setNorm in subclass.
Lucene::MultiReader::norms
virtual ByteArray norms(const String &field)
Returns the byte-encoded normalization factor for the named field of every document.
Lucene::MultiReader::~MultiReader
virtual ~MultiReader()
Lucene::MultiReader::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::MultiReader::clone
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Clones the subreaders. (see IndexReader#clone()).
Lucene::MultiReader::isCurrent
virtual bool isCurrent()
Checks recursively if all subreaders are up to date.
Lucene::MultiReader::doReopen
IndexReaderPtr doReopen(bool doClone)
If clone is true then we clone each of the subreaders.
Lucene::MultiReader::_hasDeletions
bool _hasDeletions
Definition MultiReader.h:34
Lucene::MultiReader::hasDeletions
virtual bool hasDeletions()
Returns true if any documents have been deleted.
Lucene::MultiReader::getTermFreqVector
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...
Lucene::MultiReader::getTermFreqVectors
virtual Collection< TermFreqVectorPtr > getTermFreqVectors(int32_t docNumber)
Return an array of term frequency vectors for the specified document. The array contains a vector for...
Lucene::MultiReader::terms
virtual TermEnumPtr terms(const TermPtr &t)
Returns an enumeration of all terms starting at a given term.
Lucene::MultiReader::doDelete
virtual void doDelete(int32_t docNum)
Implements deletion of the document numbered docNum.
Lucene::MultiReader::terms
virtual TermEnumPtr terms()
Returns an enumeration of all the terms in the index.
Lucene::MultiReader::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::MultiReader::getVersion
virtual int64_t getVersion()
Not implemented.
Lucene::MultiReader::termDocs
virtual TermDocsPtr termDocs()
Returns an unpositioned TermDocs enumerator.
Lucene::MultiReader::numDocs
virtual int32_t numDocs()
Returns the number of documents in this index.
Lucene::MultiReader::reopen
virtual IndexReaderPtr reopen()
Tries to reopen the subreaders.
Lucene::MultiReader::doClose
virtual void doClose()
Implements close.
Lucene::MultiReader::maxDoc
virtual int32_t maxDoc()
Returns one greater than the largest possible document number.
Lucene::MultiReader::normsCache
MapStringByteArray normsCache
Definition MultiReader.h:31
Lucene::MultiReader::getSequentialSubReaders
virtual Collection< IndexReaderPtr > getSequentialSubReaders()
Returns the sequential sub readers that this reader is logically composed of.
Lucene::MultiReader::_maxDoc
int32_t _maxDoc
Definition MultiReader.h:32
Lucene::MultiReader::readerIndex
int32_t readerIndex(int32_t n)
Find reader for doc n.
Lucene::MultiReader::termPositions
virtual TermPositionsPtr termPositions()
Returns an unpositioned TermPositions enumerator.
Lucene::MultiReader::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::MultiReader::isDeleted
virtual bool isDeleted(int32_t n)
Returns true if document n has been deleted.
Lucene::MultiReader::subReaders
Collection< IndexReaderPtr > subReaders
Definition MultiReader.h:28
Lucene::MultiReader::document
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...
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::TermEnumPtr
boost::shared_ptr< TermEnum > TermEnumPtr
Definition LuceneTypes.h:235
Lucene::FieldSelectorPtr
boost::shared_ptr< FieldSelector > FieldSelectorPtr
Definition LuceneTypes.h:77
Lucene::TermFreqVectorPtr
boost::shared_ptr< TermFreqVector > TermFreqVectorPtr
Definition LuceneTypes.h:237
Lucene::TermVectorMapperPtr
boost::shared_ptr< TermVectorMapper > TermVectorMapperPtr
Definition LuceneTypes.h:254
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition LuceneTypes.h:539
Lucene::TermPtr
boost::shared_ptr< Term > TermPtr
Definition LuceneTypes.h:233
Lucene::DocumentPtr
boost::shared_ptr< Document > DocumentPtr
Definition LuceneTypes.h:74
Lucene::TermPositionsPtr
boost::shared_ptr< TermPositions > TermPositionsPtr
Definition LuceneTypes.h:243
Lucene::IndexReaderPtr
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition LuceneTypes.h:157
Lucene::TermDocsPtr
boost::shared_ptr< TermDocs > TermDocsPtr
Definition LuceneTypes.h:236

clucene.sourceforge.net