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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 
26 
27 protected:
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 
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

clucene.sourceforge.net